question

betterealm avatar image
betterealm asked

How to find PlayFab Player ID in Photon events

Hi,

I'm using PlayFab + Photon, and just finished implementing the Room creation.

I also implemented the function OnPlayerEnteredRoom(Player player) but the player object is mostly empty. I'm also not interested in the Photon player info, but rather in the PlayFab player info.

I successfully integrated PlayFab with Photon and made sure the authentication between the two services functions properly (I'm getting the Photon token while logging in to PlayFab through Unity).

I don't want to use the PlayFabServerAPI to get the Player's information since it would be insecure.

I used this guide, which is vastly outdated, complicated and lacking information:

https://docs.microsoft.com/en-us/gaming/playfab/sdks/photon/quickstart#photon-room-event--cloudscript

Do I absolutely have to implement the CloudScript functions just to know who joined the Room?

Am I missing some kind of event in Photon/PlayFab's API that shows the PlayFab Player Data in Photon events?

Player Dataphotondata
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

For Photon integration, Cloud Script is used to handle webhook, however, Cloud Script itself is not compulsory but very convenient if you also use PlayFab. Please try to read the values in parameter "args" of your defined Cloud Script Function and property "userID" should be the PlayFab ID that triggers this function. Please refer to the payload sample in Photon quickstart - PlayFab | Microsoft Docs.

>>I don't want to use the PlayFabServerAPI to get the Player's information since it would be insecure.

It is safe to execute server API in Cloud Script because players cannot review or directly interact server-side code and can only get the response that you decide. Though necessary verification steps are still required.

We also recommend implementing Azure Function, please refer to Jay's answer in this thread -- Photon Webhooks without Cloud Scripts - Playfab Community

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.