Class: OmniAuth::Strategies::GoogleOauth2
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::GoogleOauth2
- Defined in:
- lib/omniauth/strategies/google_oauth2.rb
Constant Summary collapse
- DEFAULT_SCOPE =
Possible scopes: userinfo.email,userinfo.profile,plus.me
"userinfo.email,userinfo.profile"
Instance Method Summary collapse
Instance Method Details
#authorize_params ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/omniauth/strategies/google_oauth2.rb', line 19 def base_scope_url = "https://www.googleapis.com/auth/" super.tap do |params| scopes = (params[:scope] || DEFAULT_SCOPE).split(",") scopes.map! { |s| s =~ /^https?:\/\// ? s : "#{base_scope_url}#{s}" } params[:scope] = scopes.join(' ') # This makes sure we get a refresh_token. # http://googlecode.blogspot.com/2011/10/upcoming-changes-to-oauth-20-endpoint.html params[:access_type] = 'offline' if params[:access_type].nil? params[:approval_prompt] = 'force' if params[:approval_prompt].nil? params[:state] = request.params['state'] if request.params['state'] end end |
#raw_info ⇒ Object
54 55 56 |
# File 'lib/omniauth/strategies/google_oauth2.rb', line 54 def raw_info @raw_info ||= access_token.get('https://www.googleapis.com/oauth2/v1/userinfo').parsed end |