Skip to content

Discord Authentication

Follow these steps to enable "Sign in with Discord" on your Spokes server using the built-in Casdoor identity provider.

  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 (/organization) page.
  3. Click the Open Casdoor button in the top right corner to open the Casdoor dashboard.
  4. Go to Identity -> Providers -> Add in the top navigation bar.
  5. Configure the following fields:
    • Name: provider_discord
    • Category: OAuth
    • Type: Discord
    • Client ID: (Paste your Client ID from Step 1)
    • Client Secret: (Paste your Client Secret from Step 1)
  6. Click Save & Exit.
  1. Go to Identity -> Applications in Casdoor and edit the spokes application.
  2. Under the Providers section, click Add and select provider_discord from the dropdown list.
  3. Click Save & Exit at the bottom of the page.

Depending on how open or private you want your server to be, here are the three common ways to control who can register with Discord:

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

  1. While editing the spokes application in Casdoor, scroll to the Signup items table.
  2. Find the row for Invitation code and uncheck the Required box (and optionally uncheck Visible).
  3. Make sure Enable signup is toggled ON.
  4. Click Save & Exit.

Only specific Discord email addresses or domains are allowed to register.

  1. Go to Identity -> Providers and edit provider_discord.
  2. In the Email regex field, enter a regular expression matching the emails you want to allow, then save the provider:
    • Specific Domain: .*@yourdomain\.com$
    • Specific Email List: ^(friend1@gmail\.com|friend2@gmail\.com)$
  3. Go back to Identity -> Applications, edit spokes, and uncheck Required on the Invitation code row in the Signup items table.
  4. Tip: If you want to force users to sign in exclusively with Discord and disable manual username/password signups, you can hide the Signup link in the Signin items table and uncheck Visible on the items in the Signup items table.
  5. Click Save & Exit.
Section titled “Option 3: Invite-Only (Link to Existing Accounts)”

Only users who already have an account (or an invitation code) can sign in with Discord.

  1. In the spokes application settings, keep Invitation code checked as Required in the Signup items table. This blocks strangers from creating new accounts.
  2. Make sure Enable Email linking is toggled ON.
  3. Click Save & Exit. (When an existing user whose Casdoor account has the same email address clicks the Discord login button, Casdoor will match their email and link their Discord account automatically.)

  • "Invalid OAuth2 Redirect URI" (in Discord): The Redirect URL in the Discord Developer Portal does not exactly match https://<your-spokes-domain>/callback. Check for typos, trailing slashes, or http:// instead of https://.
  • "Failed to load callback handler" (in Casdoor/Spokes): Your Discord Client Secret is incorrect. Reset the secret in the Discord Developer Portal and paste the new value into provider_discord in Casdoor.