> For the complete documentation index, see [llms.txt](https://docs.lootlocker.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lootlocker.com/players/authentication/how-to/sign-in-with-discord.md).

# Discord

{% hint style="info" %}
The Discord platform needs to be enabled and configured in the Web Console before it can be used in your game.
{% endhint %}

#### Configuration

To start using Sign in with Discord we first need to configure our integration in the [platform settings](https://console.lootlocker.com/settings/platforms/discord).

<figure><img src="/files/fmeFcM5EaTLqwYncELjO" alt="Discord platform settings"><figcaption></figcaption></figure>

**Client ID & Client Secret**

Client ID can be retrieved from the [Discord Developer Portal](https://discord.com/developers/applications). If you don't have an Application, you will have to create.

#### Start Session

You need to acquire either a [Discord Access Token](https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-access-token-exchange-example) or a Discord Refresh Token (also returned from the Access Token Exchange) to be able to start a Discord session, but once you have that, simply follow along to the code snippet below. In the response from LootLocker you will find a refresh token which can be used to refresh the session so that you do not need to do the full sign-in flow each time.

{% tabs %}
{% tab title="Unity" %}
coming soon
{% endtab %}

{% tab title="Unreal" %}
coming soon
{% endtab %}

{% tab title="REST" %}

```bash
curl -X POST "https://api.lootlocker.io/game/session/discord" \
  -H "Content-Type: application/json" \
  -d "{\"game_key\": \"your_game_key\", \"access_token\": \"eyJQa....\", \"game_version\": \"1.0.0.0\" }"
```

Example response:

```json
{
  "session_token": "eb13a7bf17efg36cb8481a8ds18809c7e85686e6",
  "player_id": 9358,
  "public_uid": "J72YP6MS",
  "player_name": null,
  "player_created_at": "2023-02-21T15:33:25+00:00",
  "check_grant_notifications": false,
  "check_deactivation_notifications": false,
  "seen_before": true,
  "refresh_token": "eyJh............................."
}
```

{% endtab %}
{% endtabs %}

#### Refresh Session

With Discord authentication, you can refresh the session instead of having the player do a full sign-in every time. The request will return a 401 (Unauthorized) if the refresh token has expired, in which case you will need to start a new session.

{% tabs %}
{% tab title="Unity" %}

{% endtab %}

{% tab title="Unreal" %}

{% endtab %}

{% tab title="REST" %}

```bash
curl -X POST "https://api.lootlocker.io/game/session/discord" \
  -H "Content-Type: application/json" \
  -d "{\"game_key\": \"your_game_key\", \"refresh_token\": \"eyJQa....\", \"game_version\": \"1.0.0.0\" }"
```

Example response:

```json
{
  "session_token": "eb13a7bf17efg36cb8481a8ds18809c7e85686e6",
  "player_id": 9358,
  "public_uid": "J72YP6MS",
  "player_name": null,
  "player_created_at": "2023-02-21T15:33:25+00:00",
  "check_grant_notifications": false,
  "check_deactivation_notifications": false,
  "seen_before": true,
  "refresh_token": "eyJh............................."
}
```

{% endtab %}
{% endtabs %}

{% hint style="success" %}
Congratulations - you have now started using LootLocker in your game with Sign in with Discord! Next up we suggest you look at our [feature set,](/the-basics/what-is-lootlocker.md#overview) and decide which ones you want to use in your game.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.lootlocker.com/players/authentication/how-to/sign-in-with-discord.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
