Module: OpenAuth2::Provider::Google

Defined in:
lib/open_auth2/provider/google.rb

Constant Summary collapse

Options =
{
  :authorize_url  => 'https://accounts.google.com',
  :code_url       => 'https://accounts.google.com',
  :authorize_path => '/o/oauth2/auth',
  :redirect_uri   => 'http://localhost:9393/google/callback',
  :token_path     => '/o/oauth2/token',
  :endpoint       => 'https://www.googleapis.com'
}

Class Method Summary collapse

Class Method Details

.parse(config, body) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/open_auth2/provider/google.rb', line 13

def self.parse(config, body)
  json                    = JSON.parse(body)

  config.access_token     = json['access_token']
  config.token_arrived_at = Time.now
  config.token_expires_at = Time.now+3600

  # google sends refresh_token when getting access_token, but not
  # when refreshing
  unless config.refresh_token
    config.refresh_token = json['refresh_token']
  end
end