Access token warning when logging in using Facebook JavaScript SDK

前端 未结 5 779
我在风中等你
我在风中等你 2021-02-07 09:33

I\'m using debug.js and getting the following message when executing FB.login:

You are overriding current access token, that me

相关标签:
5条回答
  • 2021-02-07 09:36

    It is probably because you called FB.getLoginStatus followed by FB.login. The error just means that you received an access token the first time when you called .getLoginStatus and then it was overwritten when you called .login.

    You can fix this by either removing .getLoginStatus (it is probably unnecessary if you are about to call .login) or instead re-use the access token from .getLoginStatus and pass it to the .login function.

    0 讨论(0)
  • 2021-02-07 09:39

    I solved the issue, the problem was that I was requesting a permission that the app was not approved for, and not using an FB account that was associated with the app in any way. By adding the user in question as a test user, the problem was solved. It's rather unfortunate that the error Facebook returns is so completely useless in this case. Hope this helps!

    0 讨论(0)
  • 2021-02-07 09:41

    The real answer is the FB javascript SDK itself has problems, such as the one you reported. You may not be doing anything wrong, the error is probably with FB's SDK (AND / OR with their documentation)

    I've reported and documented a similar error at the FB developers community forum, but don't expect a resolution anytime soon. https://developers.facebook.com/community/threads/445494736399091/ This happened in Dec 2019, when using Chrome, and the FB JS sdk v5.0

    Update: I've since found out there are a few variables involved: For example, when using Chrome, some callbacks are firing multiple times, and returning a different accessToken, and the error message as reported in your question.

    When I switched to the Edge Browser, it reported a normal facebook user is not allowed, while the app is in Test mode. wtf? (Chrome allowed my normal fb user). So I created a test user in the developer's dashboard, and when i logged in again, I did not get the error message as reported in your question.

    Now, I went back to Chrome, still using my normal fb user (not the special test user), and don't see the error message anymore, or callbacks firing multiple times. (Is this because I gave it sometime to reset itself? who knows !)

    0 讨论(0)
  • 2021-02-07 09:46

    Just make sure you have the following:

    window.fbAsyncInit = function() {
            FB.init({
              appId      : '{tu_id}',
              cookie     : true,
              status     : true,
              xfbml      : true,
              version    : 'v3.3'
            });
    
    0 讨论(0)
  • 2021-02-07 09:47

    For us, we missed whitelisting the IP address after migrating the server to a new cloud provider. Updating the IP Address whitelist from Facebook Developer Dashboard:

    Settings -> Advanced -> Security

    resolved the issue

    0 讨论(0)
提交回复
热议问题