Reputation: 374
We have a website using Facebook login. 4 days ago, without performing any change, the login button stopped functioning.
The call to FB.init works well using:
function initFB() {
FB.init({
appId: ufm_config.fbAppId,
cookie: true,
oauth: true,
xfbml: true,
logging: true,
autoLogAppEvents: true,
frictionlessRequests: true,
status: true,
version: 'v2.12'
});
FB.getLoginStatus(fbConnectionChanged);
FB.Event.subscribe("auth.login", fbConnectionChanged);
FB.Event.subscribe('auth.authResponseChange', fbConnectionChanged);
FB.Event.subscribe("auth.logout", fbConnectionChanged);
}
The call to getLoginStatus(fbConnectionChanged) also works and the callback are being fired.
After The page is loaded the user can click on the Facebook login button, when he does we call to FB.Login(fbConnectionChanged). I can see the call being added to the "calls" array in the Facebook sdk code but the callback is not being fired.
When I click again on the button I see the "calls" array still contains the previous login request, and now the second request is just being added there. All the calls are just being stuck there:
f.__buffer.calls.push([a, Array.prototype.slice.call(arguments)])
Even if I change the FB.Login(fbConnectionChanged) call to FB.getLoginStatus(fbConnectionChanged) instead, I get the same behaviour, so its not just the login call itself.
We didn't change anything in the Facebook App also, and the site is configured in the "Valid OAuth Redirect URIs".
What else can I try to do to solve it?
When I call FB.login() from the console it works fine. Couldn't understand why it doesn't work on the button click function yet.
Upvotes: 1
Views: 3424
Reputation: 46
We faced the same issue 3-4 days back. The calls are going to __buffer. The problem here is FB has changed something on their sdk which internally loads a newer version of SDK. When you do init, the initial version is loaded and returned synchronously.
https://connect.facebook.net/en_US/sdk.js loads https://connect.facebook.net/en_US/sdk.js?hash=39f310e26cdcb1dd91634dc45d62ffe9&ua=modern_es6 asynchronously. So, the way we got around this was to initialise FB on load of the page itself. And then use FB or window.FB to make other calls on click(asynchromously). Thats why it works on the console too as the newer sdk is loaded by then and is available to be used.
pseudo example code:
constructor() {
FB.init({...})
}
onButtonClicked() {
FB.login({...})
}
Also, noticed that the __buffer is now replaced by __globalCallbacks in the newer sdk loaded.
Hopefully this helps
Upvotes: 2