Authentication #

Pragma Engine provides dedicated gateways for different session types.

Each gateway supports its own authentication endpoint. An identity provider token is passed to Pragma Engine, the provider token is validated and exchanged for a Pragma session token.

The Pragma token can then be used to connect to the relevant gateway.

Complete authentication tutorials are available for both Unreal and Unity.

Gateways #

Player - Game clients connect to the Player gateway. This is facilitated by the Pragma SDK embedded in your game project.

Partner - This is a trusted endpoint protected by VPN. This enables server-to-server communication for trusted services such as dedicated game servers.

Operator - This is a trusted endpoint protected by VPN. This powers APIs for the web portal and other admin capabilities.

Quick Guides #

Authenticating and logging in with the social platform #

You have several options for authenticating and logging in with your game project. Sending these authenticateOrCreateV2 requests and adding the relevant code to your project will result in pragmaTokens.

Data contained in pragmaGameToken JSON Web Token:

{
  "sub": "c03f3065-c10b-4225-96f7-051ff530009c",
  "backendType": "GAME",
  "displayName": "test01",
  "pragmaSocialId": "2af287fa-972b-41a7-936e-a48bf275a2a1",
  "iss": "pragma",
  "sessionType": "PLAYER",
  "exp": 1645017067,
  "iat": 1644930667,
  "pragmaPlayerId": "c03f3065-c10b-4225-96f7-051ff530009c",
  "jti": "d0d82e2a-8da0-4f43-ac66-d10e0b4cbdc7",
  "discriminator": "0001"
}

Data contained in pragmaSocialTokenJSON Web Token:

{
  "sub": "2af287fa-972b-41a7-936e-a48bf275a2a1",
  "backendType": "SOCIAL",
  "displayName": "test01",
  "pragmaSocialId": "2af287fa-972b-41a7-936e-a48bf275a2a1",
  "iss": "pragma",
  "sessionType": "PLAYER",
  "exp": 1645017067,
  "iat": 1644930667,
  "jti": "71b2ed06-13f7-4440-aa67-20971a90deec",
  "discriminator": "0001"
}

Using Unsafe Provider #

Send authenticateOrCreateV2 with providerId UNSAFE:

{
  "providerId": "UNSAFE",
  "providerToken": "{\"accountId\":\"test01\",\"displayName\":\"test01\"}",
  "gameShardId": "00000000-0000-0000-0000-000000000001"
}

Using Discord #

Send authenticateOrCreateV2 with providerId DISCORD:

{
  "providerId": "DISCORD",
  "providerToken": "{\"providerToken\":\"$DiscordToken\"}",
  "gameShardId": "00000000-0000-0000-0000-000000000001"
}

Using Steam #

Pragma 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–Pragma Engine will interpret and validate them both correctly.

Send authenticateOrCreateV2 with providerId STEAM:

Session Tickets
{
  "providerId": "STEAM",
  "providerToken": "$SteamToken",
  "gameShardId": "00000000-0000-0000-0000-000000000001"
}
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"
}
All fields from this provider token are provided by Steamworks when a user is redirected back to Pragma Engine after the initial OAuth login.