问题
An odd question, but hopefully someone has an answer.
I am developing a mobile app that will connect with Facebook. Everything was working fine and had been for about a week. I could authorize and remove authorization and post to a user's feed.
On Saturday or Sunday I modified my request to add offline_access. Around that time (unfortunately I cannot be sure exactly when) I started receiving failures coming back saying the access token was invalid ("Error validating access token: The session has been invalidated because the user has changed the password.").
I know this to be false because I haven't changed my password and I just received the access token and the responses were all fine. In fact, I post to the feed immediately after getting authorized ("Hey, I'm using TheApp") and that post fails with the above error.
Here's where it escalates: I went to the mobile Facebook app to verify access and connectivity. Suddenly the official FB app starts giving me the same problems. It starts popping up login dialogs. I enter my password, it shows a toast saying login succeeded and then asks for the login again a few seconds later. After a try or two of this it ends up displaying another toast with the invalid token message from above.
I clear my app, uninstall it, logout and clear all FB data (using Manage Apps in the device settings), and force stop the app. I can't uninstall FB so that's the most I can do. I also go to the FB site and change my FB password. I go back to the FB app, login again, and before the feed activity even finishes loading it's prompting me for my password again and we're back into that old cycle. I try my app and it's in the same bucket (no surprise there).
Two more data points:
- I can sometimes get this same behaviour to occur using the Graph API Exlorer web app. I can do it consistently with a token for the Graph API Explorer itself and I can get it inconsistently with an access token from my app.
- I fired up an emulator (one without the FB app) and ran my app there. Logging in as me I can get an access token and everything works. My app posts to my feed with no complaints.
At this point, FB (and apparently any FB-connecting app) is hosed on my real device. It is either just the device or a combination of the device plus my account (I haven't any other FB account to try).
Can anyone shed some light on what I need to do to either debug this further or clear it up?
来源:https://stackoverflow.com/questions/7883524/how-can-i-remove-all-potentially-cached-tokens-or-session-ids-on-android