Class: Jm81auth::OAuth::Facebook

Inherits:
Base
  • Object
show all
Defined in:
lib/jm81auth/oauth/facebook.rb

Constant Summary collapse

ACCESS_TOKEN_URL =
'https://graph.facebook.com/oauth/access_token'
DATA_URL =
'https://graph.facebook.com/me'

Instance Method Summary collapse

Methods inherited from Base

#data, #display_name, #email, #initialize, #provider_data, #provider_id, #provider_name

Constructor Details

This class inherits a constructor from Jm81auth::OAuth::Base

Instance Method Details

#get_access_tokenObject



7
8
9
10
# File 'lib/jm81auth/oauth/facebook.rb', line 7

def get_access_token
  response = client.post(ACCESS_TOKEN_URL, @params)
  JSON.parse(response.body)['access_token']
end

#get_dataObject



12
13
14
15
16
17
18
# File 'lib/jm81auth/oauth/facebook.rb', line 12

def get_data
  response = client.get(
    self.class::DATA_URL, access_token: @access_token,
    fields: 'id,name,email'
  )
  @data = JSON.parse(response.body)
end