Class: HolisticAuth::Providers::Google

Inherits:
GenericProvider show all
Defined in:
lib/holistic_auth/providers/google.rb

Constant Summary collapse

SETTINGS =
{
  site: 'https://accounts.google.com',
  token_url: '/o/oauth2/token',
  user_info_url: 'https://www.googleapis.com/plus/v1/people/me/openIdConnect',
}.freeze

Instance Attribute Summary

Attributes inherited from GenericProvider

#api_key, #client_id, #client_secret, #oauth2_client, #site, #tenant_id, #token_url, #user_info_url

Instance Method Summary collapse

Methods inherited from GenericProvider

#add_secrets, #empty?, #exchange, #full_site_url, #initialize, #present?, #secrets, #site_token_url, #to_hash

Constructor Details

This class inherits a constructor from HolisticAuth::Providers::GenericProvider

Instance Method Details

#nameObject



14
15
16
# File 'lib/holistic_auth/providers/google.rb', line 14

def name
  :google
end

#retrieve_user_info(access_token) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/holistic_auth/providers/google.rb', line 18

def (access_token)
  client = GoogleClient::Builder.new('plus', 'v1', 1)
  result = client.execute access_token,
                          api_method: client.service.people.get,
                          parameters: {
                            userId: 'me',
                          }

   JSON.parse(result.body)
end

#settingsObject



10
11
12
# File 'lib/holistic_auth/providers/google.rb', line 10

def settings
  SETTINGS
end