Google plus API shutdown today, which alternative can be used to authentication?

后端 未结 1 1177
自闭症患者
自闭症患者 2020-12-02 02:55

I am using rails-4, and have used OAuth-2 for authentication with Google+ API, for which the following gems are used, in my app:

相关标签:
1条回答
  • 2020-12-02 03:50

    Finally, I somehow managed to solve the issue by providing an alternate OpenIdConnect endpoint for user information. Using source, I replaced:

    https://www.googleapis.com/plus/v1/people/me/openIdConnect
    

    with:

    https://www.googleapis.com/oauth2/v3/userinfo
    

    I monkey-patched omniauth-google-oauth2 as follows:

    config/initializers/omniauth_google_oauth2_patch.rb

    class OmniAuth::Strategies::GoogleOauth2 < OmniAuth::Strategies::OAuth2
      def raw_info
        @raw_info ||= access_token.get('https://www.googleapis.com/oauth2/v3/userinfo').parsed
      end
    end
    

    And it's working great now.

    0 讨论(0)
提交回复
热议问题