开发者

Android Facebook app logout issue

开发者 https://www.devze.com 2023-04-03 17:52 出处:网络
My app uses Fac开发者_如何学Cebook 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 log

My app uses Fac开发者_如何学Cebook 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?


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

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).

hope this helps

0

精彩评论

暂无评论...
验证码 换一张
取 消