question

ericstock avatar image
ericstock asked

Need to access Client Session ticket from Azure Function Cloudscript

I am calling a cloudscript azure function through PlayFabCloudScriptAPI.ExecuteFunction.

Once this function executes, I would like to make a call

https://docs.microsoft.com/en-us/rest/api/playfab/client/player-data-management/update-user-data?view=playfab-rest

on behalf of the player (client). I notice in this document: https://docs.microsoft.com/en-us/gaming/playfab/features/automation/cloudscript-af/cloudscript-af-context

that the Cloudscript function is passed an EntityToken through the TitleAuthenticationContext. Unfortunately the Update user data call I would like to use is an older API call and requires the Session Ticket.

Please advise on how I can access the session ticket. Is this ticket passed to the Cloudscript function? If not what do you suggest?

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

·
Gosen Gao avatar image
Gosen Gao answered

There is a server version of UpdateUserData, which can be called with Secret Key. You can have a look.

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.

ericstock avatar image ericstock commented ·

This will require my function to store a secret key to allow any server function call to be made. Would it not be more secure to use the session ticket to make the call on behalf of the user?

0 Likes 0 ·
Gosen Gao avatar image Gosen Gao ericstock commented ·

The Azure Function is on behalf of the server, you shouldn’t call client APIs with it. As long as you don’t return the secret key to the client in AF, it should be safe, and it's only used to call the APIs you are using in the current Azure Function. If you want to call the API on behalf of the user, you don’t need to use the AF, you can call the client API directly.

1 Like 1 ·
ericstock avatar image ericstock Gosen Gao commented ·

Thank you for the help Gosen. I have implemented the server api calls as you suggested.

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.