- Home /
Facebook Logout using SDK
Hello,
I am trying to integrate Facebook in my game. I am using the 'FB.Logout()' call to log the user out of Facebook in my game.
I successfully logout the user. But the next time when I try to login the same user(currently myself), its giving me an error:
So I went to Facebook and checked in my settings -> Apps: I am seeing my game as an app there already.
I read on the documentation: "On all the platforms it will also invalidate any access token that you have for the user that was issued before the logout."
If I remove the app from Facebook and try logging in my game again, it works. Which is clearly impossible to be expect from users to do.
Is there a way to do this.
My game is currently deployed on Android, but the same issue is seen on standalone PC version as well.
Code: private void CallFBLogin() { FB.Login("public_profile", LoginCallback); }
void LoginCallback(FBResult result)
{
if (result.Error != null){
lastResponse = "Error Response:\n" + result.Error;
}
else if (!FB.IsLoggedIn)
{
lastResponse = "Login cancelled by Player";
//Reset (true);
}
else
{
lastResponse = "Login was successful!";
GetLivePermissions(); //Get Current permissions given by user.
}
Debug.Log(lastResponse);
}
public void CallFBLogout() //Called to log out user
{
FB.Logout();
}