Discord OAuth Connection Verification & Testing

Current Status ✅

Bot Token: Updated with new token (as of latest deployment) Environment Variables: All configured Endpoints: Live and responding

What Should Work

✅ 1. Login with Discord (New Scenario)

Scenario: User clicks "Continue with Discord" on /login with Discord email matching existing account

Steps:

  1. Go to https://aethex.dev/login

  2. Click "Continue with Discord" button

  3. Authorize on Discord

  4. Should show success and redirect to /dashboard

Expected Result: User logged in with Discord account linked


✅ 2. Login with Discord (Email Mismatch)

Scenario: Discord email doesn't match any existing AeThex account

Steps:

  1. Go to https://aethex.dev/login

  2. Click "Continue with Discord" button

  3. Authorize with Discord account that has different email

  4. Should show error: "Discord email not found"

  5. Click back to login and sign in with your email instead

Expected Result: User shown helpful error message, redirected to login


Scenario: User already logged in, wants to link Discord

Steps:

  1. Sign in with email/password on /login

  2. Go to /dashboard?tab=connections

  3. Find Discord card

  4. Click "Link Discord" button

  5. Authorize Discord

  6. Should see Discord as "Linked" in connections

Expected Result: Discord account linked to existing user


✅ 4. Discord Bot Commands

Scenario: User types Discord commands in a server where bot is present

Commands to Test:

Expected Result: All commands respond without errors


OAuth Flow Diagram


Environment Variables (Current)


Discord Developer Portal Checklist

Make sure these are configured in Discord Developer Portal:


Testing Checklist

Basic Connectivity

OAuth Login Tests

OAuth Linking Tests

Bot Command Tests


Troubleshooting

"Redirect URI mismatch" error

  • Problem: Discord OAuth callback failing

  • Solution: Verify https://aethex.dev/api/discord/oauth/callback is registered in Discord Developer Portal

"Invalid token" error

  • Problem: Bot token expired or revoked

  • Solution: Get new token from Discord Developer Portal

Bot commands not working

  • Problem: Commands not registered with Discord

  • Solution: Run /api/discord/admin-register-commands endpoint with DISCORD_ADMIN_REGISTER_TOKEN

Session lost during linking

  • Problem: User logged out after Discord OAuth redirect

  • Solution: This should NOT happen anymore - we use database sessions instead of cookies


Success Indicators ✅

All flows working when you see:

  1. ✅ Discord button visible on login page

  2. ✅ Can authorize on Discord and return to aethex.dev

  3. ✅ Discord appears in Dashboard connections

  4. ✅ Bot commands work in Discord

  5. ✅ No session loss during OAuth redirects

  6. ✅ Helpful error messages when things go wrong

Last updated