Hello,
I’m running into an issue with the Facebook login/logout that I’m hoping someone can point me in the right direction with. For reference, I’m running Version 2014.2189.
I have an issue where calling facebook.logout() does not seem to clear the stored access_tokens for a user’s Facebook account, and so these are invalidated when the user changes their account login and then attempts to use Facebook in my application. Here’s the steps for how I re-produce this issue:
- User is logged into their Facebook account via Settings -> Facebook on their iOS Device. This is only an issue if users are using their Facebook account in the Settings -> Facebook tab of the device, if users are logged out here and are just using the Facebook mobile app or safari to authenticate them, this never seems to occur and resets correctly.
- Have user change password for their account on Facebook, but don’t update it in the Settings -> Facebook tab on their device.
- Launch game - Attempt to call facebook.login() to sign the user into Facebook.
- Receive the following response when the user attempts to login: {“error”:{“message”:“Error validating Access Token. The session has been invalidated because the user has changed the password.”,“type”:“OAuthException”,“error_subcode”:460,“code”:190}}
- Upon receive this response, I call facebook.logout() followed by facebook.login() to attempt to flush the current access_token and force them to sign in again with their updated credentials. However, I keep continually getting the error received in step #4.
- The user must manually go to Settings -> Facebook on their iOS Device outside of the application and enter their new password, or logout/login with their new account username and password.
- After manually logging back in via Settings -> Facebook on their iOS Device, calling facebook.login() within the application works again.
I can detect these sorts of errors and tell users to go update their Facebook username/password in the Settings -> Facebook tab on their device, but I’d rather not have to tell users to take this step manually when it seems like the access_token should be flushed when I call facebook.logout() in my app.
Is there any other way to successfully destroy the previous access_token for a Facebook user and have them login with their account credentials again? As stated before, this process seems to work fine if you are using the Facebook mobile app or Safari to authenticate their login, but there’s not much I can do about that if they are signed into their Facebook account under Settings -> Facebook, as it will default to the account they have tied to their mobile device.
Any advice would be greatly appreciated.
Thanks!