question

mak avatar image
mak asked

How do i read ExtraHeaders in CloudScript from function args, context or other way ? if possible plz give me example

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

·
JayZuo avatar image
JayZuo answered

If you mean the extra headers that we can inject in each API request, then I'm afraid it's not possible to get them in CloudScript.

In CloudScript, args parameter is an object representation of the FunctionParameter field of an ExecuteCloudscript request. context parameter is additional information about the request when it is triggered by a PlayStream event action, including the data from the event that triggered the action (context.playStreamEvent) and the profile data for the player associated with it. (context.playerProfile). For more info, please see https://api.playfab.com/docs/tutorials/landing-automation/writing-custom-cloud-script. Extraheaders is added to support double encrypted logins. You should not need this in CloudScript. To pass something to CloudScript, usually you should set FunctionParameter/Arguments and then retrieve with args.

If you have any special requirement, please feel free to let us know.

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.

mak avatar image mak commented ·

My concern is for security purpose if i have client token then i can easily access cloud script and client token can be easily taken from just api request.

0 Likes 0 ·
Andy avatar image Andy ♦♦ mak commented ·

You are correct, a valid sessionTicket gives a client the ability to execute Cloud Script. You would need to determine what the right level of verification to perform in your Cloud Script functions is. If you'd like to pass in encrypted data which you then decrypt to prove an identity, you can. It's a very flexible system, but that flexible does create opportunities for security holes if you're not careful.

Also, we do plan to support proper session tokens at some point. This should help to reduce the vulnerability of the sessionTickets of today.

0 Likes 0 ·
mak avatar image mak Andy ♦♦ commented ·

So is there way to read extra headers in cloud scripts ?

Other options like encryption may be cracked if user know algoritham

0 Likes 0 ·
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.