Photon Server and PlayFab
Options
Dunk
✭
I built my game using Photon Cloud with PlayFab authentication and webhooks, but now want to move to Photon Server to make the game more robust to cheating by moving authoritative logic to the server using a plugin.
I've spent a day trying everything and googling everywhere since it seems an obvious use-case, but I can't make it work or find a single example of an on-premises photon server hooking up nicely to PlayFab.
My problem seems to be a failure in the authentication step, and it's probably something in the Loadbalancing GameServer and Master Photon.LoadBalancing.dll.config files that is misconfigured.
I'm currently getting this error when trying to join/joinRandom/create a room:
"Operation 227 failed in a server-side plugin. Check the configuration in the Dashboard. Message from server-plugin: Failed to create game on https://2036.playfablogic.com/webhook/1/prod/***MYPHOTONSECRETKEY***/GameCreate? : Error response ResultCode='1' Message='No title found for AppId'."
(titleid and secret key removed here but they're the same values that work in the photon cloud)
I changed the GameServer and Master dll.configs to include the webhooks plugin 1.2, webRPCs and AuthSettings with a custom authprovider as here:
Thanks,
Duncan
I've spent a day trying everything and googling everywhere since it seems an obvious use-case, but I can't make it work or find a single example of an on-premises photon server hooking up nicely to PlayFab.
My problem seems to be a failure in the authentication step, and it's probably something in the Loadbalancing GameServer and Master Photon.LoadBalancing.dll.config files that is misconfigured.
I'm currently getting this error when trying to join/joinRandom/create a room:
"Operation 227 failed in a server-side plugin. Check the configuration in the Dashboard. Message from server-plugin: Failed to create game on https://2036.playfablogic.com/webhook/1/prod/***MYPHOTONSECRETKEY***/GameCreate? : Error response ResultCode='1' Message='No title found for AppId'."
(titleid and secret key removed here but they're the same values that work in the photon cloud)
I changed the GameServer and Master dll.configs to include the webhooks plugin 1.2, webRPCs and AuthSettings with a custom authprovider as here:
<!-- Enable webhooks plugin by setting Enabled to "true" --> <PluginSettings Enabled="true"> <Plugins> <Plugin Name="WebHooksPlugin1.2" Version="" AssemblyName="PhotonHive.WebhooksPlugin1.2.dll" Type="Photon.Hive.Plugin.WebHooks.PluginFactory" BaseUrl="https://2036.playfablogic.com/webhook/1/prod/***MYPHOTONSECRETKEY***" IsPersistent="true" HasErrorInfo="true" PathClose="GameClose" PathCreate="GameCreate" PathEvent="GameEvent" PathGameProperties="GameProperties" PathJoin="GameJoin" PathLeave="GameLeave" PathLoad="GameCreate" /> </Plugins> </PluginSettings> <!-- Enable webRPCs by setting Enabled to "true" --> <WebRpcSettings Enabled="true"> <BaseUrl Value="https://2036.playfablogic.com/webhook/1/prod/***MYPHOTONSECRETKEY***" /> </WebRpcSettings> <!-- Enable Custom Authentication by setting Enabled to "true" --> <AuthSettings Enabled="true" ClientAuthenticationAllowAnonymous="false"> <AuthProviders> <AuthProvider Name="Custom" AuthenticationType="0" AuthUrl="https://2036.playfabapi.com/photon/authenticate" appid="***MYPHOTONAPPID***" secret="***MYPHOTONSECRETKEY***" /> </AuthProviders> </AuthSettings>Am I missing something obvious here? Am I on the right path here, or is PlayFab not supposed to be used with Photon Server in this way?
Thanks,
Duncan
0
Comments
-
Hi @Dunk,
Photon Server does not officially and fully support PlayFab integration.
The error message 'No title found for AppId' means that PlayFab expects webhooks and webRPCs requests to contain a JSON key AppId with the value set to the Photon Realtime AppId configured on the GameManager / Photon add-on.
So the self-hosted needs to set the same AppId (thanks @chvetsov for pointing me to the exact line and file):
file path: "\src-server\Loadbalancing\LoadBalancing\GameServer\GameApplication.cs"
line: 232
changethis.HwId
with your Photone Realtime AppId configured on the GameManager / Photon add-on.
Or change webhooks plugin code to send that AppId (either hardcoded or configured), change the value of AppId property (getter) in:
"\src-server\HivePlugin\PluginBase.cs"
or override it in (new) or change all occurrences with the actual value of your AppId in:
"\src-server\Plugins\WebHooks1.2\WebHooksPlugin.cs"
Of course, you need to compile and deploy again once changes are made.
Note:
In the custom authentication configuration, you don't need extra keys "appid" and "secret".0 -
Thank you JohnTube, I would've never figured that out myself!0
-
Hi. Its been a while to this post. But I am wanting to do similar thing. I want to move to Photon Server. Could you please explain a bit more about how you achieved that?
0 -
hi, @rizwanbabar693
we can answer on concrete answers only.
try to follow instructions you found here
if you have any obstacles than ask
best,
ilya
0