OpenFB
OpenFB copied to clipboard
Logout Problem
Hello, I use cordova/phonegap, when I logout from facebook, token becomes null, there is no problem here. However, It doesnt ask me facebook password or email when I click the login button again. So It doesnt allow me login different users. I think I can logout from app but cannot logout from inapp browser. How can I solve this problem?
I think you need to deauth the application
Through the native js api it would be
FB.api("/me/permissions", "delete", function(response){});
For that you could use the revokePermissions method which encapsulates the native api call @hutchic mentioned.
Back to topic: I got the same issue with that. I guess its because when you run it as an hybrid app on your phone there might be a problem with the redirect-url as the app does run within the filesystem and not under some domain.
@ccoenraets mentioned this as a comment above the logout method.
* IMPORTANT: For the Facebook logout to work,
the logoutRedirectURL must be on the domain
specified in "Site URL" in your Facebook App Settings
Maybe related with #35 and #10
Actually the following seemed to solve the problem. But I did not fully test everything by now.
https://github.com/vielhuber/OpenFB/commit/6cff3852e4a04b377eb4f654265a2ba1431bd316
the ,clearcache=yes fixed the logout problem for me. I only added it to the logout function and i removed the settimeout function because it's not needed for me..
I beleive the problem is a BUG, the tokenStore
key is incorrect, it should be tokenStore.removeItem('fbAccessToken');
// openfb.js
var logoutWindow,
token = tokenStore.fbAccessToken;
/* Remove token. Will fail silently if does not exist */
tokenStore.removeItem('fbtoken'); // change to tokenStore.removeItem('fbAccessToken');
I beleive the problem is a BUG, the tokenStore
key is incorrect, it should be tokenStore.removeItem('fbAccessToken');
// openfb.js
var logoutWindow,
token = tokenStore.fbAccessToken;
/* Remove token. Will fail silently if does not exist */
tokenStore.removeItem('fbtoken'); // change to tokenStore.removeItem('fbAccessToken');
I can confirm that changing
tokenStore.removeItem('fbtoken');
to
tokenStore.removeItem('fbAccessToken');
fixes the logout issue.
Yes, after changing it to -> tokenStore.removeItem('fbAccessToken') the issue has been fixed. Thanks