question

Andy Maddison avatar image
Andy Maddison asked

[Unity] IsClientLoggedIn

I found an undocumented method IsClientLoggedIn in PlayFabClientAPI.cs. Presumably this is true once the player has signed in using any of the various ways, e.g. facebook.

If I later make a call e.g. GetUserData and my session ticket has expired, will IsClientLoggedIn return false as soon as I've made the call?

10 |1200

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

brendan avatar image
brendan answered

The tools team is working to get the docs updated for IsClientLoggedIn shortly. What it's checking is that a Session Ticket exists, which means that a login operation succeeded at some point. However, the only way to know that the Session Ticket has expired is by trying a call to the service, so you do still need to check the return results from calls to PlayFab, to see if the ticket is still valid.

1 comment
10 |1200

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

arbus avatar image arbus commented ·

This still seems to be missing from the documentation.

0 Likes 0 ·
Andy Maddison avatar image
Andy Maddison answered

"However, the only way to know that the Session Ticket has expired is by trying a call to the service, so you do still need to check the return results from calls to PlayFab, to see if the ticket is still valid."

 

I understand this, but if after the call the ticket is not valid, will IsClientLoggedIn then return false?

10 |1200

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

brendan avatar image
brendan answered

No, the _authKey is updated when you call any login function. When any Client API call returns an error indicating that the Session Ticket is no longer valid, you should always proceed to logging the user in again. If you want to set the _authKey to null whenever a 401 is returned, you could create a base ErrorDetails function which does this on any 401 or invalid ticket error return, though.

10 |1200

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

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.