class AccessToken
A million thanks to Filip Tepper for github.com/filiptepper/facebook-oauth-example
Constants
- OAUTH_BASE
Public Class Methods
get(app_id, app_secret, oauth_base=OAUTH_BASE)
click to toggle source
# 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
Private Class Methods
extract_access_token(response_body)
click to toggle source
# File lib/sacrifice/access_token.rb, line 23 def self.extract_access_token(response_body) response_body. match(/=(.*)/).# response is a string like "access_token=bunch-o-crap" captures[0]. strip end