Android Facebook login issue

My app uses the Facebook SDK to post status updates. There is also a logout function. I can log in for the first time the application is running. I can successfully post msg status to facebook. But as soon as I log out, subsequent runs and attempts to update the status, I encounter an error from facebook saying "An error has occurred. Please try again later." I noticed that the authorization method on subsequent login attempts (after the first exit) tries to use the same accessToken and accessExpires (although I set them to null and 0 respectively in the exit method), and in turn, isSessionValid () returns the true method for me. And therefore, the facebook server throws me this error. Can someone please tell me how to fix this error / problem?

+2
source share
1 answer

The Facebook android SDK sets authtoken and expires_in to the general settings, so when you log out, you need to remove them.

In addition, at any time when your application starts, you should check the saved token causing the api "me" chart to be called; if there is any exception, you should delete the saved token and re-authorize. This is due to the fact that the token may be invalid (for example, when the user changes his password).

hope this helps

+2
source

Source: https://habr.com/ru/post/1233277/


All Articles