Facebook token Android SDK refresh criteria

2019-08-10 20:35发布

问题:

I wished to understand the facebook refresh cycle for the long term access token (60 days).

Although their doc implies

If I make a graph '/me' call a day after obtaining the access token, the token expiry would be updated or extended

but the same isn't the case. I tried querying the /me endpoint via their android SDK but the token expiry wasn't updated.

I came across a similar question Facebook: refresh AccessToken on Android but the suggestion didn't work for me.

Ps: Would be happy to share code but I doubt that is needed.

-------EDIT------

My use case involves only authentication at the client end , followed up with submitting the token to my server. This token is periodically used by my server to fetch updated user info. In order to accomplish this I need to ensure that the token never expires at the client. I don't wish to relogin the user on token expiry as far as possible.

回答1:

The first line in the document you linked states:

Facebook's official SDKs manage the lifetime of tokens for you. When using iOS, Android or our JavaScript SDK, the SDK will handle making sure that tokens are refreshed before they expire.

If you read through the documentation, you can see that if the user uses the app, the SDK will refresh your token daily. If the user has not used it in 60 days, then he has to log in again to get a new token.

Altogether, no action is required on your side for refreshing the token manually. Why do you think you have to refresh the token?