Class: AccessToken

Inherits:
Object
  • Object
show all
Defined in:
lib/sacrifice/access_token.rb

Overview

A million thanks to Filip Tepper for github.com/filiptepper/facebook-oauth-example

Constant Summary collapse

OAUTH_BASE =
'https://graph.facebook.com/oauth/access_token'

Class Method Summary collapse

Class Method Details

.get(app_id, app_secret, oauth_base = OAUTH_BASE) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/sacrifice/access_token.rb', line 10

def self.get(app_id, app_secret, oauth_base=OAUTH_BASE)
  response = RestClient.get(
      oauth_base,
      :params => {
          'client_id' => app_id,
          'client_secret' => app_secret,
          'grant_type' => 'client_credentials' # FB magic string
      })

  extract_access_token(response)
end