question

v2k avatar image
v2k asked

[UnitySDK] Event for dropped login?

There's a function to check if you're logged in:

public static bool IsClientLoggedIn()

Wondering if I'm missing an event I can listen to for when the player's login becomes invalid for any reason?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

The thing to do is to check the responses to any Client API call to the service, to see if the response is that the token is not longer valid. In that case, you would need to sign the user back in. Please note that IsClientLoggedIn only checks if there is a session ticket - it does not perform an active query to the service. We do have a work item open to null the local session ticket when the response to an API call is that the token has expired, but even with that change it will still be important to properly manage any error responses.

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

v2k avatar image v2k commented ·

I'm not sure if one can check the response if the SDK throws an exception when IsClientLoggedIn returns false on any PlayFabClientAPI call. Are you suggesting the client should wrap every API call in a IsClientLoggedIn check?

0 Likes 0 ·
brendan avatar image brendan v2k commented ·

No, to be clear, I'm saying you need to check the response to all Client API calls for errors. If the error response is that the token is invalid, you should sign the user back in. The IsClientLoggedIn call just tells you if you (locally) have a session ticket, whether or not it is still valid.

0 Likes 0 ·
v2k avatar image v2k v2k commented ·

uh, your reply seems to have vanished...

-1 Like -1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.