Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
FaceBook JavaScript SDK no response is sent when login cancelled

I am working with the FaceBook JavaScript SDK to log users in via FaceBook SSO. documentation

Clicking the SSO button opens a new window prompting the user to log in via FaceBook. If the user logs in there is no issue. However, if the user exits or cancels the SSO, I am not getting a response from FB.

Here is the function given in the FB documentation:

FB.login(function(response) {
    if (response.authResponse) {
     console.log('Welcome!  Fetching your information.... ');
     FB.api('/me', function(response) {
       console.log('Good to see you, ' + response.name + '.');
     });
    } else {
     console.log('User cancelled login or did not fully authorize.');
    }
});

I have tried using this function exactly and again if I cancel the SSO the else block never runs as I would expect it to.

I am trying to modify the function slightly but I still am not able to get a response when the page is cancelled.

    static login(callbacks, { mode = "login" }) {
        const FB = window.FB;
        FB.login(
            (res) => {
                console.log(res);
                const { authResponse } = res;
                if (mode === "login") {
                    Facebook.socialSignOn(authResponse, callbacks);
                } else if (mode === "verify") {
                    Facebook.socialVerify(authResponse, callbacks);
                }
            },
            { return_scopes: "true", scope: "email" }
        );
    }

UPDATE

After playing around more it seems like if I try to use the FB SSO, cancel, and then try again all future FB.login() attempts immediately receive a response with authResponse : null

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!