facebook-sdk-for-unity icon indicating copy to clipboard operation
facebook-sdk-for-unity copied to clipboard

FB.IsLoggedIn does not return false when unauthorized

Open jayvan opened this issue 7 years ago • 4 comments

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?

jayvan avatar Oct 01 '18 21:10 jayvan

Any updates on that? Is it fixed already?

daniel-keen avatar Jan 24 '19 12:01 daniel-keen

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 avatar Jan 24 '19 12:01 jayvan

Hi! Any updates on this? Is it fixed already?

guidoPaglie avatar Apr 17 '20 15:04 guidoPaglie

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.
            }
        }

oliverebert avatar Feb 17 '22 12:02 oliverebert