简体   繁体   English

Facebook Unity SDK-在Facebook设置中取消对帐户的授权不会在登录时引发问题

[英]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? 通过Facebook帐户设置取消对令牌的授权时,在这里我应该看到什么问题? 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? 我是否必须实际发送API查询并处理错误,还是有另一种方法来确保AccessToken仍然有效?

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. 您可以尝试调试令牌, https://developers.facebook.com/docs/facebook-login/access-tokens/debugging-and-error-handling-但这需要应用访问令牌或用户令牌app admin作为附加参数,仅应在服务器端代码中完成。

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. 另外,如果您始终进行API调用以调试令牌,那么对于令牌仍然非常合适的任何人,这都会减慢您的应用程序运行速度。 So trying to make your regular API call, and react if that fails due to an expired token, might be the better alternative. 因此,尝试进行常规API调用,如果由于令牌过期而导致失败,则做出反应可能是更好的选择。


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. 要以最小的开销“验证”令牌,您只需发出/me?fields=id请求,然后如果令牌有效,则只需返回应用程序范围的用户ID,否则返回错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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