Android的Facebook应用程序注销的问题

问题描述:

我的应用程序使用Facebook的SDK发布状态更新。也有一个注销功能。我可以登录第一次应用程序运行。我可以在Facebook发布状态味精成功。但一旦我退出,随后运行并尝试更新的状态我遇到的错误从Facebook说:发生错误,请稍后再试。我注意到,在随后尝试登录(第一次注销后)的授权方法试图使用相同的accessToken和accessExpires并反过来isSessionValid()方法返回(虽然我已经在注销方法分别将它们设置为null,0)在我的身上。因此Facebook的服务器引发了我这个错误。 谁能告诉我如何修复这个bug /问题?

My app uses Facebook SDK to post status updates. ALso there is a logout feature. I can login the first time the app is run. I can post status msg in facebook successfully. But once i logout , the subsequent runs and attempts to update status i encounter error from facebook saying "An error occured. Please try again later". I have noticed that the authorize method on subsequent attempts to login ( after the first logout) tries to use the same accessToken and accessExpires ( although i have set them to null and 0 respectively in the logout method) and in turn isSessionValid() method returns true for me. And hence the facebook server throws me this error. Can anyone please tell me how to fix this bug/issue?

的authToken和expires_in共享preferences,所以当你退出,你需要从中删除他们的Facebook Android SDK中集。

Facebook android SDK sets authtoken and expires_in in shared preferences, so when you logout you need to delete them from there.

另外,你的应用程序启动的任何时候你要验证打电话给图形API我所保存的道理,如果你要删除保存令牌,并重新授权任何异常。这是因为令牌可能被无效(例如,当用户改变他们的密码)。

Also, any time your app starts you have to validate the saved token making a call to graph api "me", if there is any exception you have to delete saved token and reauthorize. This is because the token might be invalidated (for example when the user changes their password).

希望这有助于