Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access token warning when logging in using Facebook JavaScript SDK

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?

like image 827
Ney Avatar asked Apr 17 '17 04:04

Ney


People also ask

How do I stop enforce https on Facebook Developer?

This setting is in the Products > Facebook Login > Settings section of the App Dashboard. Disable this setting if you are not building a custom web login flow or using the Facebook Login SDK on the web. Enforce HTTPS.

What is access token in Facebook?

An access token is an opaque string that identifies a user, app, or Page and can be used by the app to make graph API calls. When someone connects with an app using Facebook Login and approves the request for permissions, the app obtains an access token that provides temporary, secure access to Facebook APIs.


2 Answers

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!

like image 192
Jim Edelstein Avatar answered Sep 19 '22 08:09

Jim Edelstein


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.

like image 22
Wills Manley Avatar answered Sep 17 '22 08:09

Wills Manley