BetterStarter logo
BetterStarter
Docs
GuidesAuth Providers

Discord Auth

Add Discord OAuth sign-in to your app.

Docs are in beta — content is improving rapidly. Found something missing? Open an issue on GitHub or reach out on Twitter (X).

1. Create a Discord Application

  1. Go to the Discord Developer Portal and click New Application
  2. Give it a name and click Create
  3. In the left sidebar, click OAuth2
  4. Under Redirects, add:
    • http://localhost:3000/api/auth/callback/discord (dev)
    • https://yourdomain.com/api/auth/callback/discord (prod)
  5. Copy the Client ID and Client Secret from the OAuth2 page

2. Set Environment Variables

# .env.local
DISCORD_CLIENT_ID=your-client-id
DISCORD_CLIENT_SECRET=your-client-secret

3. Enable in Config

In src/appConfig.ts set:

discord: { enabled: true },

4. Test

  1. Run pnpm dev
  2. Navigate to /auth/sign-in
  3. A Sign in with Discord button will appear

Production Checklist

  • Add your production callback URL to the Redirects list in the Discord Developer Portal

Troubleshooting

  • No email returned — Discord phone-only accounts don't return an email even with the email scope. This is a Discord limitation.
  • No Discord button — check DISCORD_CLIENT_ID and DISCORD_CLIENT_SECRET are set and discord.enabled is true in appConfig.ts

On this page