Class: OmniAuth::Strategies::GoogleOauth2

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/google_oauth2.rb

Overview

Main class for Google OAuth2 strategy.

Constant Summary collapse

ALLOWED_ISSUERS =
['accounts.google.com', 'https://accounts.google.com'].freeze
BASE_SCOPE_URL =
'https://www.googleapis.com/auth/'
BASE_SCOPES =
%w[profile email openid].freeze
DEFAULT_SCOPE =
'email,profile'
USER_INFO_URL =
'https://www.googleapis.com/oauth2/v3/userinfo'

Instance Method Summary collapse

Instance Method Details

#authorize_paramsObject



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/omniauth/strategies/google_oauth2.rb', line 30

def authorize_params
  super.tap do |params|
    options[:authorize_options].each do |k|
      params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])
    end

    params[:scope] = get_scope(params)
    params[:access_type] = 'offline' if params[:access_type].nil?
    params['openid.realm'] = params.delete(:openid_realm) unless params[:openid_realm].nil?

    session['omniauth.state'] = params[:state] if params[:state]
  end
end

#custom_build_access_tokenObject Also known as: build_access_token



91
92
93
94
95
96
# File 'lib/omniauth/strategies/google_oauth2.rb', line 91

def custom_build_access_token
  access_token = get_access_token(request)

  verify_hd(access_token)
  access_token
end

#raw_infoObject



87
88
89
# File 'lib/omniauth/strategies/google_oauth2.rb', line 87

def raw_info
  @raw_info ||= access_token.get().parsed
end