Class: OpenAuth2::Provider::Facebook

Inherits:
Object
  • Object
show all
Defined in:
lib/open_auth2/provider/facebook.rb

Instance Method Summary collapse

Instance Method Details

#optionsObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/open_auth2/provider/facebook.rb', line 4

def options
  {
    :authorize_url            => 'https://graph.facebook.com',
    :code_url                 => 'https://www.facebook.com',
    :refresh_token_grant_name => 'fb_exchange_token',
    :refresh_token_name       => 'fb_exchange_token',
    :authorize_path           => '/dialog/oauth',
    :token_path               => 'oauth/access_token',
    :endpoint                 => 'https://graph.facebook.com'
  }
end

#parse(config, response_body) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/open_auth2/provider/facebook.rb', line 16

def parse(config, response_body)
  resp = response_body.gsub('access_token=', '')
  resp = resp.split('&expires=')

  config.access_token     = resp[0]
  config.refresh_token    = resp[0]
  config.token_arrived_at = Time.now
  config.token_expires_at = (Time.now.to_date+60).to_time
end