Updated the facebook login_from to allow logins using the Facebook JavaScript SDK #350

Merged
merged 3 commits into from Jan 12, 2013

Projects

None yet

4 participants

@mbillard
mbillard commented Oct 5, 2012

The login_from for Facebook now allows users to login using an access token directly instead of using the code parameter. This allows login via the Facebooj JS SDK (FB.login).

To easily integrate the client side behavior, you can just hijack the click on the facebook button like so (in CoffeeScript):

# assumes that the Facebook JS SDK has been loaded beforehand
$('#facebook-sign-in').on "click", (e) ->
  e.preventDefault()
  FB.login (response) ->
    window.location = "/auth/facebook/callback?access_token=#{response.authResponse.accessToken}&expires_in=#{response.authResponse.expiresIn}" if response.authResponse
@ph
ph commented Nov 8, 2012

Anyone else is using this? i'll give it a shot this week.

@mbillard
mbillard commented Nov 8, 2012

I don't think so, but it seems like a fairly standard use case. I've been using the code above for a while now and haven't had any issue.

@andredigenova

I need this use case and have hacked it in to my own local copy. Would love to see this pulled.

@NoamB NoamB merged commit 0e59abe into NoamB:master Jan 12, 2013
@NoamB
Owner
NoamB commented Jan 12, 2013

Had to revert some of this to make tests pass again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment