Created
December 30, 2010 16:02
-
-
Save kenmazaika/759925 to your computer and use it in GitHub Desktop.
Grab a new facebook token using AuthLogic connect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def facebook | |
if(params[:code]) | |
token = HTTParty.get('https://graph.facebook.com/oauth/access_token', :query => {'client_id' => AuthlogicConnect.config[:connect][:facebook][:key], 'redirect_uri' => facebook_url, 'client_secret' => AuthlogicConnect.config[:connect][:facebook][:secret], 'code' => params[:code]}).body.gsub(/\Aaccess_token=/, '') | |
return render :text => {:token => token }.inspect | |
end | |
# Bounce the user to the Facebook, this gets hit on the first entrance to the url | |
params.merge!({:oauth_provider => 'facebook', :authentication_type => 'session'}) | |
@user_session = UserSession.new | |
@user_session.save do |result| | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment