Class: OmniAuth::Strategies::GoogleOAuth2
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::GoogleOAuth2
- Defined in:
- lib/omniauth/strategies/google_oauth2.rb
Instance Method Summary collapse
Instance Method Details
#auth_hash ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/omniauth/strategies/google_oauth2.rb', line 32 def auth_hash OmniAuth::Utils.deep_merge(super, { 'uid' => info['uid'], 'info' => info, 'credentials' => {'expires_at' => access_token.expires_at}, 'extra' => {'user_hash' => user_data} }) end |
#request_phase ⇒ Object
14 15 16 17 |
# File 'lib/omniauth/strategies/google_oauth2.rb', line 14 def request_phase super end |
#setup_authorize_params ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/omniauth/strategies/google_oauth2.rb', line 19 def opts = { :client_id => [:client_id], :redirect_uri => callback_url, :response_type => "code", :scope => [:scope] } google_email_scope = "www.googleapis.com/auth/userinfo.email" opts[:scope] ||= "https://#{google_email_scope}" opts[:scope] << " https://#{google_email_scope}" unless opts[:scope] =~ %r[http[s]?:\/\/#{google_email_scope}] [:authorize_params] = opts.merge([:authorize_params]) end |
#user_data ⇒ Object
55 56 57 |
# File 'lib/omniauth/strategies/google_oauth2.rb', line 55 def user_data @data ||= access_token.get("https://www.googleapis.com/userinfo/email?alt=json").parsed end |