Authentication #

With Pragma Engine you can use your own identity provider to authenticate your players and operators. Authenticated players and operators can then use your game client to make requests to Pragma Engine.

After a player logs in to your identity provider the identity provider passes a session token to the Pragma Engine. The engine then exchanges the provider token for a Pragma session token. For more information about sessions, see Login and Session.

To try out setting up authentication, see the Unreal and Unity authentication tutorials.

Player and Operator Authentication #

Pragma Engine supports multiple identity providers for player and operator authentication. Below are the available identity providers and their respective values. For more information, see Identity Providers.

Identity ProviderIdentity Provider Values
To add additional identity providers, see Custom Identity Providers.

You can use either the identity provider name or identity provider value on authenticateorcreatev2 for the providerId.

The following examples show the required authenticateorcreatev2 request body. If you don’t use the Pragma SDK to authenticate your users, see Authenticate using RPC.

Example test identity provider

Send authenticateOrCreateV2 with providerId UNSAFE.

  "providerId": "UNSAFE",
  "providerToken": "{\"accountId\":\"test01\",\"displayName\":\"test01\"}",
  "gameShardId": "00000000-0000-0000-0000-000000000001",
  "loginQueuePassToken": "test queue pass token"
Example Steam identity provider

Pragma Engine supports authentication to Steam either via Session Tickets or the Steamworks Web API. See the Steam auth docs for more information about Session Tickets or the Steamworks Web API. Both authentication tokens use the same provider, and Pragma Engine will interpret and validate them both correctly.

All fields from this provider token are provided by Steamworks when a user is redirected back to Pragma Engine after the initial OAuth login.

Send authenticateOrCreateV2 with providerId STEAM using Session Tickets or the Steamworks Web API.

Session Tickets

  "providerId": "STEAM",
  "providerToken": "$SteamToken",
  "gameShardId": "00000000-0000-0000-0000-000000000001",
  "loginQueuePassToken": "test queue pass token"

Steamworks Web API

  "providerId": "STEAM",
  "providerToken": "{
    \"claimedId\": \"claimed_id\",
    \"ns\": \"ns\",
    \"mode\": \"mode\",
    \"opEndpoint\": \"op_endpoint\",
    \"identity\": \"identity\",
    \"returnTo\": \"return_to\",
    \"responseNonce\": \"response_nonce\",
    \"assocHandle\": \"assoc_handle\",
    \"signed\": \"signed\",
    \"sig\": \"sig\"
  "gameShardId": "00000000-0000-0000-0000-000000000001",
  "loginQueuePassToken": "test queue pass token"
Example generic identity provider

This example uses Discord as the generic identity provider. All identity providers, other than the unsafe and Steam identity providers, use this request body.

  "providerId": "DISCORD",
  "providerToken": "$DiscordToken",
  "gameShardId": "00000000-0000-0000-0000-000000000001",
  "loginQueuePassToken": "test queue pass token"

Authenticate with RPC #

When authenticating with Pragma, we recommend you use the Pragma SDK. The Pragma SDK completes all the following steps for you and reduces the possibility for errors. For more information about authentication using the Pragma SDK, see Pragma Engine SDK Setup Guides.

To manually create an authentication workflow for your client, use the following steps.

  1. Make a call to the getinqueue endpoint. The endpoint returns a JSON object with an encrypted loginQueuePassToken.
    1. Check the isAllowed field in the JSON object.
    2. If the isAllowed field is false continue to poll using the checkTicket endpoint until the JSON object returns with isAllowed set to true.
  2. When the isAllowed field is set to true, make a call to the authenticateorcreatev2 endpoint with the loginQueuePassToken included in the authenticateorcreatev2 request body.
Example authenticateorcreatev2 body with loginQueuePassToken
   "providerToken": "{\"accountId\":\"test01\",\"displayName\":\"test01\"}",
   "loginQueuePassToken": "test queue pass token"

If you enable the devLoginQueueBypass configuration, skip the above steps. The authenticateorcreatev2 body won’t have the loginQueuePassToken. For more information, see Login queue testing and development.

Example authenticateorcreatev2 body without loginQueuePassToken
   "providerToken": "{\"accountId\":\"test01\",\"displayName\":\"test01\"}",

Generate Partner tokens #

Once you have successfully authenticated into Pragma Engine as an Operator, you can generate trusted Partner tokens.

Use Portal #

Partner tokens can be generated for both production and test environments using Portal.

  1. Access the Social Portal by opening the 11200 port for your game and log in. Use the Pragma Unsafe login for test environments, and one of the verified identity provider logins for production environments.
  2. Open the Services section, and select the Game Server Management page.
  3. Use the Select a Game Shard dropdown to select the game shard to associate it with the generated Partner token.
  4. On the Partner Tokens tab, click + Create Tokens to generate Partner tokens for both Game and Social.

Use Postman #

Partner tokens can only be generated for test environments using Postman, because the authentication step uses the Unsafe Provider.

  1. Send authenticateorcreatev2 as an Operator.
  2. Send createpartnertokenV1 with the correct gameShardId to receive a payload with Partner tokens for both Game and Social.
Game tokens are valid per game shard, and social tokens are valid across the entire Social gateway.