Correct use of FB.Logout in Facebook Unity3D SDK

I am currently working on a little code to properly exchange the Unity SDK usage for some client applications and I am facing a minor issue where the Facebook Unity SDK docs show that I should not be doing what I am. Basically, I want to know if I am doing the right thing.

  • In the foreword - the documentation for FB.Logout suggests that the client application should never actually call it as it will log out of Facebook from the global web, which is contrary to their expectations. (See https://developers.facebook.com/docs/unity/reference/current/FB.Logout )
  • In my code, when I get an error from facebook that could mean the token was invalidated, I drop a simple request that should always succeed if the user's token is still valid. If that fails, I call FB.Logout, because without that, the call to FB.Login will simply fail again - the user's token will remain the same and the login call will succeed.
  • Behaviourally everything behaves as we would like it to - by calling FB.Logout, it just clears out the local state and lets me revert to my "initialized but not logged in" situation.

Basically, I want to know if this is the expected behavior, and if, contrary to the documentation, this is the correct case to call FB.Logout.

Cheers, Jeremy

+3


source to share


1 answer


FB.Logout will take you out of Facebook and your web application.

On a mobile device, it will exit your app.

This is by design and your implementation is correct.



On the web, this method will take the user out of your site and Facebook. On iOS and Android, it will take the user out of your Application.

On all platforms, it will also revoke any access token you have for the user that was issued prior to logout.

Wed https://developers.facebook.com/docs/unity/reference/current/FB.Logout/

0


source







All Articles