class Facebook::AccountKit::TokenExchanger

Public Class Methods

new(authorization_code) click to toggle source
# File lib/facebook/account_kit/token_exchanger.rb, line 6
def initialize(authorization_code)
  @authorization_code = authorization_code
end

Public Instance Methods

fetch_access_token() click to toggle source
# File lib/facebook/account_kit/token_exchanger.rb, line 10
def fetch_access_token
  result = HTTP.get compose_url
  result['access_token']
end

Private Instance Methods

app_access_token() click to toggle source
# File lib/facebook/account_kit/token_exchanger.rb, line 35
def app_access_token
  ['AA', Configuration.facebook_app_id, Configuration.account_kit_app_secret].join('|')
end
compose_url() click to toggle source
# File lib/facebook/account_kit/token_exchanger.rb, line 27
def compose_url
  URI(token_url + '?' + params)
end
params() click to toggle source
# File lib/facebook/account_kit/token_exchanger.rb, line 17
def params
  user_params = {
    grant_type: 'authorization_code',
    code: @authorization_code,
    access_token: app_access_token
  }

  URI.encode_www_form(user_params)
end
token_url() click to toggle source
# File lib/facebook/account_kit/token_exchanger.rb, line 31
def token_url
  "https://graph.accountkit.com/#{Configuration.account_kit_version}/access_token"
end