# Discord

Source: https://next.coolify.io/docs/core/security/authentication/oauth/discord

Create a Discord application so Coolify can request the `identify` and `email` scopes during sign-in.

> **Warning: Example data**
>
> Replace the example domain while following this guide:
>
> * **Coolify URL:** `https://coolify.shadowarcanist.com`
> * **Redirect:** `https://coolify.shadowarcanist.com/auth/discord/callback`

## Set up Discord OAuth

### Create a Discord application

Open the [Discord Developer Portal](https://discord.com/developers/applications), select **New Application**, enter a name such as `Coolify`, and create the application.

The application does not need a bot for Coolify sign-in.

### Register the Coolify redirect

Open **OAuth2** for the Discord application. Under **Redirects**, select **Add Redirect** and enter:

```txt
https://coolify.shadowarcanist.com/auth/discord/callback
```

Save the changes.

Coolify supplies the `identify` and `email` scopes when it starts authorization. You do not need to generate or copy an OAuth URL from Discord.

### Copy the Discord credentials

On the **OAuth2** or **General Information** page, copy **Client ID**.

Copy or reset the **Client Secret**, then store the complete value securely. Resetting the secret invalidates the previous value.

### Configure Discord in Coolify

Open **Settings > Authentication** and find **Discord**.

| Coolify field     | Discord value                                              |
| :---------------- | :--------------------------------------------------------- |
| **Client ID**     | Discord application **Client ID**                          |
| **Client Secret** | Discord application **Client Secret**                      |
| **Redirect URI**  | `https://coolify.shadowarcanist.com/auth/discord/callback` |

Select **Save**, then turn on **Enabled** for Discord.

### Verify Discord sign-in

Coolify identifies an existing user by email address. The email address on the Discord account must match the email address on the Coolify account. Matching is case-insensitive.

Open the Coolify login page in a private browser window and select **Login with Discord**. Authorize the application, then confirm that Coolify opens the account with the matching email address.

An existing account can be linked only when Discord returns a verified email address. New accounts follow the registration settings. See [OAuth sign-in behavior](https://next.coolify.io/docs/core/security/authentication/oauth/overview).

## Troubleshooting

**Discord reports an invalid redirect URI**

Confirm that the exact Coolify callback appears under the Discord application's **OAuth2 > Redirects** list and has been saved.

**Coolify returns to the login page**

Confirm that the Discord account has an email address and that it matches the email address on the existing Coolify account. Also confirm that the authorization screen includes both `identify` and `email` access. If the client secret was reset, update **Client Secret** in Coolify.
