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 6676499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:59:46+00:00 2026-05-26T03:59:46+00:00

In the authentication flow documentation here it mentions the CODE which is returned upon

  • 0

In the authentication flow documentation here it mentions the CODE which is returned upon oAuth authentication.

Is this required for the Javascript SDK or is this handled automatically in the background in this code?

By “is this required?” I mean, do I have to handle this code to verify the authenticity of the request, or does the JavaScript SDK use the code automatically to gain the access_token.

The documentation explains the client side flow, and how to get the access token using the ‘code’ so until now. I’ve been assuming that the SDK manages this automatically in the background, because it produces an access code as response.authResponse.accessToken.

FB.login(function(response) {

    if (response.authResponse) {

        // User is logged in to Facebook and accepted permissions

        // Assign the variables required
        var access_token = response.authResponse.accessToken;
        var fb_uid = response.authResponse.userID;

        alert(dump(response.authResponse));

        // Construct data string to pass to create temporary session using PHP
        var fbDataString = "uid=" + fb_uid + "&access_token=" + access_token;
        // Call doLogin.php to log the user in
        $.ajax({
            type: "POST",
            url: "ajax/doLogin.php",
            data: fbDataString,
            dataType: "json",
            success: function(data) {

                // Get JSON response
                if (data.result == "failure")
                {
                    alert(data.error_message);

                    window.location.reload();

                    return false;
                }
                else if (data.result == "success")
                {
                    window.location.reload();

                    return true;
                }

            },
            error: function() {
                return false;
            }
        });

    } else {
        // user is not logged in and did not accept any permissions
        return false;
    }
}, {scope:'publish_stream,email'});

I would like to know, because I want to ensure that my code is secure.

  • 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-05-26T03:59:46+00:00Added an answer on May 26, 2026 at 3:59 am

    From the documentation

    With this code in hand, you can proceed to the next step, app authentication, to gain the access token you need to make API calls.

    In order to authenticate your app, you must pass the authorization code and your app secret to the Graph API token endpoint at https://graph.facebook.com/oauth/access_token. The app secret is available from the Developer App and should not be shared with anyone or embedded in any code that you will distribute (you should use the client-side flow for these scenarios).

    If you plan on using the FB.api function to make calls to their Graph API, then you need the code to get the access token. But if you only need to authenticate the user, then what you have will do that just fine.

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

Sidebar

Related Questions

I'm developing an OAuth authentication flow purely in JavaScript and I want to show
Here's the flow I'm looking for for authentication: Attempt to pull in the user's
this is the code : def openid_done(request, provider=None): When the request reaches here, the
I've been following the guide here: https://developers.facebook.com/docs/authentication/ Once I have the server-side flow section
Which authentication sql server is more secure windows or sqlserver authentication? Why?
Which authentication plugin for Rails would you choose? I'm not interested in the permissions,
I have an SSIS package which reads an Excel File (Data Flow Source) and
Digest authentication looks like a flavor of challenge-response mechanism: theres's a random string which
I am trying to understand, how facebook authentication works and how the flow should
In the webapp I've built, user authentication is handled in a modal, jQuery window.

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.