Skip to content

Discord Authentication

Follow these steps to enable “Sign in with Discord” on your Spokes application.

  1. Go to the Discord Developer Portal and click New Application.
  2. Name your app (e.g., “Spokes Login”) and click Create.
  3. Go to the OAuth2 tab in the left sidebar.
  4. Under Redirects, click Add Redirect and enter your exact Spokes callback URL: https://<your-spokes-domain>/callback
  5. Copy your Client ID.
  6. Click Reset Secret and copy your Client Secret.
  1. Log into your Spokes admin account
  2. Navigate to the Members & Groups page (your-server-url.com/Organization).
  3. Click the Open Casdoor button in the top right corner to access the Casdoor dashboard.
  4. Go to Identity -> Providers -> Add in the sidebar.
  5. Configure the following fields:
    • Name: provider_discord
    • Category: OAuth
    • Type: Discord
    • Client ID: (Paste your ID from Step 1)
    • Client Secret: (Paste your Secret from Step 1)
  6. Click Save.
  1. Go to Identity -> Applications in the sidebar and edit the spokes app.
  2. Navigate to the Providers tab -> Providers section and click Add.
  3. Select provider_discord from the list.
  4. Click Save at the bottom of the page.

Depending on how open or restricted you want your server to be, there are three common ways to configure how Discord accounts are allowed to register:

Anyone with a Discord account can sign in and create an account.

  1. While editing the spokes Application, go to the UI customization tab -> Signup items section.
  2. Find the row for Invitation code and uncheck the Required box.
  3. Go to the Authentication tab and ensure Enable signup is toggled ON.
  4. Click Save.

Only specific Discord emails (e.g., specific domains) are allowed to register.

  1. Go to Identity -> Providers and edit your provider_discord.
  2. Under the Email regex field, add a regular expression to match the emails you want to allow. Save the provider.
    • Example (Specific Domain): .*@yourcompany\.com$
    • Example (Specific Email List): ^(user1@example\.com|user2@example\.com)$
  3. Go back to Identity -> Applications -> edit spokes.
  4. Go to the UI customization tab -> Signup items, and uncheck the Required box for Invitation code.
  5. Tip: To force users to ONLY use Discord and prevent manual registrations, you should make the signup link invisible (under UI customization tab -> Signin items -> Signup link) and make all items in the Signup items list invisible by unchecking their Visible boxes.
  6. Click Save.
Section titled “Option 3: Invite-Only (Link to Existing Accounts)”

Only users who have already been invited or have an existing Casdoor account can link their Discord.

  1. In the spokes Application settings, go to the UI customization tab -> Signup items -> Invitation code and keep it checked as Required. This blocks strangers from creating new accounts.
  2. Go to the Authentication tab and ensure Enable Email linking is toggled ON.
  3. Click Save. (When invited users click the Discord button, Casdoor will see their email matches their invited account and securely link them together!)

  • “Invalid OAuth2 Redirect URI” (in Discord): The Redirect URL you entered in Step 1 doesn’t exactly match your server. Double-check for typos or missing https://.
  • “Failed to load callback handler” (in Spokes): Your Discord Client Secret is incorrect. Generate a new secret in the Discord portal and paste it into your Spokes Provider settings.