Creating the Ticket Authorization Tokens
warning
This documentation is now deprecated. If you are using Matchmaker Self Serve though UDash, please use the documentation here.
In this tutorial, we will focus on creating the ticket endpoint authorization tokens needed. There are two types of tokens we need to create, the Service Token
and the Delegate Tokens
.
For the purposes of this tutorial, we will be using Postman to create the tokens.
#
Flow Overview#
Prerequisites- Being onboarded with Unity Player Identity, check Unity Player Identity to get started.
#
Creating the Service TokenThe service token is created using the client_id
and client_secret
provided during onboarding.
We use the service token
to create the Delegate Tokens
.
To create a service token
, let's create a POST request on Postman on the following endpoint: https://api.prd.identity.corp.unity3d.com/oauth2/token
.
#
Body#
Responsenote
The {service token} should be cached on the game service and never shared with the game clients.
#
Creating the Delegate TokensThe delegate token is created using the service token
created earlier. Delegate tokens have two scopes, matchmaking
, and matchmaking.read
.
- The
matchmaking
scope provides all-access to the Matchmaking service (Read, Write, Delete) - The
matchmaking.read
scope (player access token) provides read-only-access to the Matchmaking service.
#
Creating the All-Access (matchmaking) Delegate TokenThe all-access delegate token is created using the service token
created in the previous step.
The all-access delegate token is used by the game service to create/delete tickets on behalf of game clients.
To create an all-access delegate token, let's create a POST request on Postman on the following endpoint: https://api.prd.identity.corp.unity3d.com/oauth2/delegate-token
.
#
HeaderKey: Authorization
Value: Bearer {service token}
#
Body#
Responsenote
The {game-service-id} can be any unique id to identify the Game Service using the all-access delegate token.
#
Creating the Read-Only-Access (matchmaking.read) Delegate TokenThe read-only-access delegate token is created using the service token
created in the previous step.
The read-only-access delegate token is used by the game clients to poll for ticket status.
To create a read-only-access delegate token, let's create a POST request on Postman on the following endpoint: https://api.prd.identity.corp.unity3d.com/oauth2/delegate-token
.
#
HeaderKey: Authorization
Value: Bearer {service token}
#
Body#
Responsenote
The {player_id} can be any unique id to identify the client.
#
What's Next?- Configure the matchmaking logic in the Matchmaking Logic Tutorial