Class: Stormpath::Rails::FacebookAuthCodeExchange

Inherits:
Object
  • Object
show all
Defined in:
lib/stormpath/rails/facebook_auth_code_exchange.rb

Constant Summary collapse

FACEBOOK_EXCHANGE_URL =
URI('https://graph.facebook.com/v2.7/oauth/access_token')

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root_url, code) ⇒ FacebookAuthCodeExchange

Returns a new instance of FacebookAuthCodeExchange.



8
9
10
11
12
# File 'lib/stormpath/rails/facebook_auth_code_exchange.rb', line 8

def initialize(root_url, code)
  raise(NoFacebookAuthorizationError) if code.nil?
  @root_url = root_url
  @code = code
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



6
7
8
# File 'lib/stormpath/rails/facebook_auth_code_exchange.rb', line 6

def code
  @code
end

#root_urlObject (readonly)

Returns the value of attribute root_url.



6
7
8
# File 'lib/stormpath/rails/facebook_auth_code_exchange.rb', line 6

def root_url
  @root_url
end

Instance Method Details

#access_tokenObject



14
15
16
# File 'lib/stormpath/rails/facebook_auth_code_exchange.rb', line 14

def access_token
  @access_token ||= fetch_access_token(exchange_auth_code.body)
end