Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8629397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:47:42+00:00 2026-06-12T08:47:42+00:00

I followed the guide provided here by Sorcery about handling user logins with Facebook.

  • 0

I followed the guide provided here by Sorcery about handling user logins with Facebook.

# callback method called by Facebook after getting the authorization by the user
if user = login_from(provider) # provider == "facebook"
  redirect_to root_path #, :notice => "Logged in from #{provider.titleize}!"
else
  begin
    user = create_from(provider)
    ...

However it only requires that my users leave my site to go to the Facebook page and then get redirected here.

What I would like to achieve is what I see when using the Facebook JavaScript SDK which is a clean popup right in my page. To achieve this I followed a tutorial on Railscasts:

$('#sign_in').click (e) ->
  e.preventDefault()
  FB.login (response) ->
    window.location = '/auth/facebook/callback' if response.authResponse

However, the authResponse only contains an accessToken and a signedRequest and a userid while Sorcery requires a code.

Is there anyway to do this properly (or get the code using the accessToken?).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T08:47:43+00:00Added an answer on June 12, 2026 at 8:47 am

    However, the authResponse only contains an accessToken and a signedRequest and a userid while Sorcery requires a code.

    Is there anyway to do this properly (or get the code using the accessToken?).

    In the server-side flow, the code is just an intermediate step in getting the access token – app gets code, and exchanges code for an access token.

    Since in the client-side flow you already get an access token when it’s finished – it does not get any more “proper” than that.

    So you have two options:

    • either refactor your Sorcery-thingie, so that it skips the step where it gets a code and exchanges that for an access token, and directly “set” the access token yourself after getting it (wherever Sorcery might want it to be set); or

    • stick to the server-side flow, but open that yourself in a popup window. Then you’ll still get the code, but you’ll get it inside the popup window. So you’d have to close the popup window and maybe reload your original window yourself afterwards.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I followed this guide here perfectly and have gone through it again but when
I've followed the NServiceBus getting started guide to the letter, with the only change
I have followed the very terse guide provided for django-storages , transitioned from local
I followed a guide about dragging multiple images on screen with gesture recognizers however
I followed the guide here: http://developer.appcelerator.com/guides/en/app_structure.html to use high & medium density images for
I followed the guide here http://www.hackido.com/2010/01/installing-git-on-server-ubuntu-or.html but I cannot find the proper way to
I followed the guide here to create vim mapppings. Put the following in my
I have followed this guide for PHP Twitter Apps by OAuth Here in test.php
I'm having trouble. I followed a guide that I found here http://www.thenetworkadministrator.net/index.php/2011/12/iis-ssl-certificate-into-amazon-elastic-load-balancer/ And exported
I basically followed the guide to populate an event here on Blackberry's website :

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.