Access token warning when logging in using Facebook JavaScript SDK

倾然丶 夕夏残阳落幕 提交于 2019-12-04 16:51:14

问题


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

You are overriding current access token, that means some other app is expecting different access token and you will probably break things. Please consider passing access_token directly to API parameters instead of overriding the global settings.

Any clues?


回答1:


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!




回答2:


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.




回答3:


Just make sure you have the following:

window.fbAsyncInit = function() {
        FB.init({
          appId      : '{tu_id}',
          cookie     : true,
          status     : true,
          xfbml      : true,
          version    : 'v3.3'
        });



回答4:


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



来源:https://stackoverflow.com/questions/43445301/access-token-warning-when-logging-in-using-facebook-javascript-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!