PlayFab Integration


In this document we help you integrate PlayFab with Photon. With this approach, both systems will get used in parallel to their full potential. Billing is separate for each service. Find PlayFab's Photon add-on here under the "Add-ons" - "Multiplayer" section of your title. PlayFab's Photon add-on allows you to set up one or two Photon applications (one Photon Realtime and/or one Photon Chat application). Read the instructions for the setup from PlayFab side in this guide. Read on for setup instructions for Photon.

Custom Authentication

Dashboard Configuration

Here are the steps to setup custom authentication with PlayFab:

  1. Go to Photon dashbaord.
  2. Choose an application or create a new one.
  3. Click "Manage".
  4. Under "Authentication" section, click "Custom Server".
  5. [Required] Set Authentication URL to https://{PlayFabTitleId} Make sure to replace {PlayFabTitleId} placeholder with your actual PlayFab TitleId.
    Do not keep the open ({) and closing (}) braces or curly brackets characters in the URL.
    Example: if your PlayFab TitleId is AB12:
  6. Save by hitting "Create".
  7. [Recommended] Untick "Allow anonymous clients to connect, independently of configured providers".

Client Code

Client is expected to send a pair of key/values as credentials:


chatClient.AuthValues = new AuthenticationValues();
chatClient.AuthValues.AuthType = CustomAuthenticationType.Custom;
chatClient.AuthValues.AddAuthParameter("username", PlayFabUserId);
chatClient.AuthValues.AddAuthParameter("token", PlayFabPhotonToken);
chatClient.AuthValues.UserId = userId; // UserId is always required in Photon Chat
// do not set AuthValues.Token or authentication will fail
// connect


ExitGames::Common::JString params = "username="+PlayFabUserId+"&token="+PlayFabPhotonToken;
ExitGames::Chat::AuthenticationValues playFabAuthenticationValues;
// pass playFabAuthenticationValues as parameter on connect


var queryString = "username="+playFabUserId+"&token="+playFabPhotonToken;
chatClient.setCustomAuthentication(queryString, Photon.LoadBalancing.Constants.CustomAuthenticationType.Custom);
// connect
Back to top