question

Adarsh Nambiar avatar image
Adarsh Nambiar asked

Developer Secret Key & Title ID

Is Developer Secret Key same as PlayFab API Secret Key ?

and Can I hardcore the Title ID and Developer Secret Key from PlayFabSettings in my code in Unity ?

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

There is only one secret key for your title in PlayFab currently (though we're considering updating this, to enable more scenarios - like secret keys for contractors - in the future). For an administrative or development tool which will never ship to customers (or leak in any way), you should feel free to use your secret key, though I would encourage putting it in a configuration file, to be extra careful.

Under no circumstances should you ever put your secret key anywhere someone outside your team could get it, like a shipping title. That key is what provides the necessary permissions to change your title configuration, update (or delete) player info, etc.

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.

Never Rage Dungeons and Dragons avatar image Never Rage Dungeons and Dragons commented ·

Is it ok if I can see my DeveloperSecretKey In Unity Editor?

0 Likes 0 ·
Adarsh Nambiar avatar image
Adarsh Nambiar answered

Thanks Brendan! When you say configuration file .Can I store these details in CloudScript and access it ? 

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

I'm sorry, but what is the design goal you have in mind? What are you attempting to do?

If the intent is to allow the Client to use a Server or Admin API call, there is absolutely no safe way to do that. Storing the Secret Key as a static value in Cloud Script and sending it to the client would still expose your Secret Key, allowing any technically savvy user to effectively destroy your title.

If you're building admin or development tools for your title, I would just store the values locally and use them.

10 |1200

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

Adarsh Nambiar avatar image
Adarsh Nambiar answered

Basically I want the players to win an item in the game and that item gets added  to  Players Inventory in the PlayFab when the game is running.To achieve this I was using PlayFabServerAPI.GrantItemsToUser which requires developer secret key.

Ok so I guess there is no better way to do it as it is triggered from the Client side.

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

In that case, you would use Cloud Script. You can call a Cloud Script from the client, and it has full access to the Server API set. There's an example showing specifically how to grant items to players via Cloud Script in our GitHub repo: https://github.com/PlayFab/CloudScriptSamples - have a look at the Rewards example. Cloud Script gives you access to the Server API calls, while letting you build appropriate protections against cheating into the script logic.

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.