facebook-sdk-for-unity
facebook-sdk-for-unity copied to clipboard
FB.IsLoggedIn does not return false when unauthorized
The documentation for FB.IsLoggedIn says...
Check the user's authorization status. false if the user has not logged into Facebook, or hasn't authorized your app; true otherwise.
If you navigate to https://www.facebook.com/settings?tab=applications and remove an app, the app becomes unauthorized. In the Javascript SDK, FB.getLoginStatus returns not_authorized, but in the Unity SDK FB.IsLoggedIn continues to return true.
It looks like only the expiration of the token is being checked, there's no check for if the token is still authorized.
https://github.com/facebook/facebook-sdk-for-unity/blob/9389c5cfcaf1daa2a49fac39570e51b4563f37be/Facebook.Unity/FacebookBase.cs#L51-L58
This problem was particularly bad after 90 million users access tokens were revoked last Friday.
Is there any way for me to reliably determine if I need to force a user to log in to facebook again?
Any updates on that? Is it fixed already?
What we've settled on for now is doing a very light Graph API request, such as for the current users name, at launch. If that request fails because the token is unauthorized then we call login again and the user is prompted to reauth.
Hi! Any updates on this? Is it fixed already?
What we've settled on for now is doing a very light Graph API request, such as for the current users name, at launch. If that request fails because the token is unauthorized then we call login again and the user is prompted to reauth.
@jayvan strange, with this code I do not get an error if user changed Facebook password in Facebook app. Am I doing something wrong?
FB.API("me?fields=name", HttpMethod.GET, OnGetTokenStatus);
private void OnGetTokenStatus(IGraphResult result)
{
if (!string.IsNullOrEmpty(result.Error))
{
// it doesn't jump in here.
}
}