FB login callback function not responding if user is already logged in facebook

前端 未结 6 1030
星月不相逢
星月不相逢 2021-02-01 22:51

I am using fb connect using js. This is my code:



        
6条回答
  •  情话喂你
    2021-02-01 23:02

    Method 1:

    Though I believe that DMCS has given a correct solution to the problem, here is another way to approach. Use FB.login method with a custom login link.

    
    

    Body markup:

    Login with Facebook

    When you click on the button, it will run the callback function inside FB.login.

    Method 2:

    Alternatively, using FB login button plugin, you can subscribe to auth.statusChange and check for the status of the user in response.

    FB.Event.subscribe('auth.statusChange', function(response) {
      // check for status in the response
    });
    

    Note if you are using fb login button plugin, and the user is already logged in and connected to the app, no login button is shown (read it in the documentation here)

提交回复
热议问题