Skip to main content

Discord

Sign in with Discord accounts using OAuth 2.0.

1. Create OAuth App

  1. Go to the Discord Developer Portal.
  2. Click New Application and give it a name.
  3. Go to the OAuth2 section in the left sidebar.
  4. Under Redirects, add your EdgeBase callback URL (see below).
OAuth2 only

For EdgeBase sign-in, use the OAuth2 section. You do not need bot settings, interaction endpoints, webhooks, or slash-command setup for basic Discord login.

2. Set Redirect URI

Add your EdgeBase callback URL under OAuth2 > Redirects:

https://your-edgebase-url/api/auth/oauth/discord/callback

For local development:

http://localhost:8787/api/auth/oauth/discord/callback

3. Get Credentials

In the OAuth2 section:

  • Client ID — Displayed at the top of the OAuth2 page.
  • Client Secret — Click Reset Secret to generate one (copy it immediately).

4. Configure EdgeBase

// edgebase.config.ts
export default defineConfig({
auth: {
allowedOAuthProviders: ['discord'],
},
});
export default defineConfig({
auth: {
oauth: {
discord: {
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
},
},
},
});

5. Usage

client.auth.signInWithOAuth('discord');

Provider Details

PropertyValue
Scopesidentify email
PKCENo
EmailYes
Email verifiedYes — uses verified field
AvatarYes — constructed from avatar hash
Refresh tokenNo

Notes

  • Discord avatar URLs are constructed from the user's ID and avatar hash: https://cdn.discordapp.com/avatars/{user_id}/{avatar_hash}.png.
  • Users without a verified email on Discord will have emailVerified: false, which means automatic account linking with existing email accounts won't occur.
  • Local verification was completed on March 8, 2026 against http://localhost:8787/api/auth/oauth/discord/callback using the js-web browser harness. The current result was 8 passed / 1 skipped.