question

Oriol Perarnau Arnau avatar image
Oriol Perarnau Arnau asked

How do I upload files to a title_player_account whose EntityToken has expired?

Hello,

I'm trying to upload files to a title_player account, but it has an Expired entityToken and I'm trying to renew it.

I tried using the GetEntityTokenWithSecretKey with the TITLEID, DEVSECRETKEY and a request with the expired entity and that returns the EntityToken for the title master account and I need the title player account.

So my question is, how do I get the EntityToken renewed, and if that's not possible, what's the best way to do something similar.

I'm using PHP.

Thanks in advance and have a great day.

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

·
Seth Du avatar image
Seth Du answered

Could you please describe your scenario? In general, if you want to renew entity token and upload files from client side, the GetEntityTokenWithSecretKey is not recommended as it will expose your developer Secret Key to client. If you would like a “silent login” feature (authenticate player after EntityToken expired), you can check out this document: https://docs.microsoft.com/en-us/gaming/playfab/features/authentication/login/quickstart#bind-a-frictionless-device-id-to-an-existing-recoverable-account

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

Oriol Perarnau Arnau avatar image Oriol Perarnau Arnau commented ·

Hi, thanks for the response.

Our scenario: We're using a PHP webpage to upload files to specific players, then in Unity the system asks and shows them.

To do that we are saving the EntityToken of the players, and when those entitytoken expire we are not able to renew them.

The first response doesn't actually apply to our scenario, which we hope is a bit more clear now.

Thanks for answering and have a great day.

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Oriol Perarnau Arnau commented ·

If the web page is for developers only, which is an administrative tool, I believe you may need to add additional condition sentences in the error callback result, which will confirm if this error is caused by the token expiration so that your script will call GetEntityTokenWithSecretKey API again to refresh the token.

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Seth Du ♦ commented ·

I have double-checked the source code of PHP SDK, it seems GetEntityTokenWithSessionTicket and GetEntityTokenWithSecretKey API have some issues there, which may be the cause. For now, I will try to contact SDK team to see if it can be fixed.

For your scenario, I will recommend using GetEntityToken API directly and send required parameters (secret key) to the function to get the title-level entity token.

Moreover, When you hold a title-level entity token, it won't be necessary to have any title player Entity Token because the title-level entity token has the permission to upload files for any players (InitiateFileUploads API) if only you specify the title-player-account Entity Key in the request. I think the entity key is the only thing you may need clients to send to the website. If you want to do some verification, you may ask client to send entity token and call ValidateEntityToken API, but it is not necessary to cache it.

I am not expert on web development, however, please note that secret key shouldn't be exposed to the front end.

1 Like 1 ·
Show more comments

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.