question

laker avatar image
laker asked

When to use SessionTicket, PlayFabId and EntityToken

After success to login, there are SessionTicket, PlayFabId and EntityToken in the response data. I would like to know: - When to use the 3 different data? - There is TokenExpiration for EntityToken, which duration is 1 day. I would like to know what will happen when EntityToken expires. - If there is expiration for SessionTicket?

apissdks
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

·
Neils Shi avatar image
Neils Shi answered

Entity Token is used for Entity API, which is designed for Entity Programming Model, you can refer to Entity Programming Model - PlayFab | Microsoft Learn for more details. About Session Ticket, all Client API calls apart from login and password reset, require the Session Ticket as the "X-Authentication" header. And some APIs require you to provide the PlayFabId (like API GetUserData, you need to tell PlayFab which user's data you want to retrieve). When you call the Entity API but PlayFab's Entity Token has expired, you will fail and receive the error message “EntityTokenExpired”. The Session Ticket has the same lifetime as Entity Token (24h).

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

laker avatar image laker commented ·

@Leils, thanks for your reply, which helps us a lot.

We want to know: - Is there Session Expiration? - If we want to relogin to avoid expiration by using SessionTicket, EntityToken and PlayFabId, can we do that, how to do? - Is there API to get PlayFabId by using SessionTicket and EntityToken?

0 Likes 0 ·
Neils Shi avatar image Neils Shi laker commented ·

Is there Session Expiration?

Session ticket also expires. It has the same lifetime as Entity Token (24h).

If we want to relogin to avoid expiration by using SessionTicket, EntityToken and PlayFabId, can we do that, how to do?

No, PlayFab do not support relogin by using SessionTicket, EntityToken and PlayFabId. You need to call login APIs again to refresh the SessionTicket and EntityToken, and it is by design. If you want to refresh the tokens silently, You can link additional anonymous login identity for players and cache the information locally for silent login. You can refer to Login basics and best Practices - PlayFab | Microsoft Docs for more detail.

Is there API to get PlayFabId by using SessionTicket and EntityToken?

You can use API GetPlayerProfile to get PlayFabId by using SessionTicket.

0 Likes 0 ·

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.