简体   繁体   中英

Facebook Unity SDK - Deauthorizing account in Facebook settings throws no issue on login

What is specifically supposed to happen when a token is expired or the access code is no longer valid?

I check first to ensure we are logged in. If we are, I get the access code:

AccessToken.CurrentAccessToken.TokenString

When I deauthorize the token via the Facebook account settings, what should I be seeing in terms of issues here? The token still exists, the date has not yet still been reached. I am currently only using this for account linking with an external backend. Do I have to actually send an API query and handle an error or is there another way to ensure the AccessToken is still valid?

You could try and debug the token, https://developers.facebook.com/docs/facebook-login/access-tokens/debugging-and-error-handling - but since this needs either an app access token or a user token of the app admin as additional parameter, this should only be done in server-side code.

Plus, if you make API calls to debug tokens all the time, it will slow your app down for anyone who's token is still perfectly fine as well. So trying to make your regular API call, and react if that fails due to an expired token, might be the better alternative.


To “validate” a token with minimal overhead, you can just make a /me?fields=id request, then you will just get the app-scoped user id back if the token is valid, or an error otherwise.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM