Discord

This guide explains how to set up Discord as an authentication provider with Stack Auth. Discord OAuth2 allows users to sign in to your application using their Discord account.

Integration Steps

Create a Discord Developer App

  1. Navigate to the Discord Developer Portal.
  2. Click the New Application button in the top-right corner.
  3. Enter a name for your application and click Create. You will be redirected to the General Information page.
  4. Select OAuth2 in the left sidebar.
  5. Under Redirects add https://api.stack-auth.com/api/v1/auth/oauth/callback/discord
  6. In the OAuth2 section, enable the required scopes: 'identify' and 'email'
  7. Click Save Changes
  8. Save the Client ID and Client Secret. You may need to select Reset Secret to generate a new one.

Enable Discord OAuth2 in Stack Auth

  1. On the Stack Auth dashboard, select Auth Methods in the left sidebar.
  2. Click Add SSO Providers and select Discord as the provider.
  3. Set the Client ID and Client Secret you obtained from the Discord Developer Portal earlier.

User Profile Data

When a user signs in with Discord, Stack Auth will create a user profile with the following data:

  • User ID: Discord's unique user ID
  • Username: The user's Discord username
  • Avatar: The user's Discord avatar (if available)
  • Email: The user's email if the 'email' scope is requested

Need More Help?

Stack Auth AI

Documentation assistant

Experimental: AI responses may not always be accurate—please verify important details.

For the most accurate information, please join our Discord or email us.

How can I help?

Ask me about Stack Auth while you browse the docs.