> For the complete documentation index, see [llms.txt](https://docs.thndr.io/integration/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.thndr.io/integration/launch-game/standard/authenticate-users.md).

# Authenticate Users

When a player launches a game, THNDR will make a server-to-server request to the Operator to validate the session and authenticate the user.

This ensures that the sessionId provided during game launch is valid and not expired.

#### Endpoint

```url
GET {operatorURL}/thndr/sessions/{sessionToken}
```

#### Path Parameters

* `operatorURL` - Base URL of the Operator’s API.
* `sessionToken` - The session token originally provided by the Operator when launching the game. It should be single-use and expire very quickly.

Expected Response

```json
{
  "userId": "{USER_ID}",
  "displayName": "{DISPLAY_NAME}",
  "sessionId": "{OPTIONAL_SESSION_ID}",
  "currency": "{OPTIONAL_USER_CURRENCY}",
  "subOperatorId": "{OPTIONAL_SUB_OPERATOR_ID}",
  "brandId": "{OPTIONAL_BRAND_ID}",
  "isTest": false
}
```

* `userId` - Unique identifier of the player on the Operator’s platform.
* `displayName` - Player’s display name, safe for public display within THNDR games.
* `sessionId` - Must be a valid UUID if provided. If omitted, the API will treat the path parameter `sessionToken` as the session ID.
* `currency` - Player's wallet currency (read more in [Currencies](https://docs.thndr.io/integration/server-webhooks/currencies.md)).
* `subOperatorId` - Optional, 1–50 characters. For aggregators: identifies the operator you're integrating on behalf of. It is fixed to the player when the account is first created. For brands under a single operator, use `brandId` instead.
* `brandId` - Optional. Identifies the brand the player is playing under, for operators that run several brands. If sent, it must be a string of 1–50 characters. We record it on the player's session and on every round they play, for reporting by brand. Leave it out or send null if you don't use brands.
* `isTest` - Optional boolean. Marks the player as a test account. It is set the first time we see the player and can't be changed later. Leave it out (or send null) to keep the stored value.

#### Error Handling

If the session is invalid, expired, or otherwise not usable, the Operator should return:

```
HTTP/1.1 403 Forbidden
Content-Type: application/json

{
  "errors": [
    {
      "code": "SESSION_EXPIRED",
      "isClientSafe": true
    }
  ]
}
```

#### Signature Verification

Verify the request signature using “sessionId” as the request payload. More in the [Request Signing](https://docs.thndr.io/integration/server-webhooks/request-signing.md) section.

Example signed payload:

```
Server secret: DUMMY_SECRET

Payload: 5393f66c-a063-402a-92f8-c4a8326dc29b

x-server-authorization: 35786aeba64b3468b6534245b227d4b175eba257aef3e4c3b1b9f325514448c0
```
