Discord Auth Setup - cclloyd/planeshift GitHub Wiki
Step 1: Generate a Discord Application
- Go to the Discord developer portal.
- Click on
Applications
on the left side, then theNew Application
button. - Name the application whatever you wish,
PlaneShift
will suffice, anything will do. This is the name that will show up when users try to authenticate using discord.
Step 2: Get OAuth2 credentials and add a redirect URL
- Click on your newly created application
- Click on
OAuth2
on the left side - Add a redirect URL. This is in the format of
${EXTERNAL_URL}/api/auth/discord/callback
- Be sure to save any changes.
BEFORE YOU LEAVE: Take note of your Client ID and Client Secret, you will need them later
Step 3: Configure setup
Modify your docker compose file to include the following env vars
Fill in DISCORD_CLIENT_ID
and DISCORD_CLIENT_SECRET
with the values you got from step 2.
There are other optional settings you can fill in for security, which are highly recommended if your API is accessible from the internet.
services:
planeshift:
# ...rest of your settings
environment:
# ...rest of your environment
AUTH_PROVIDERS: 'discord'
# Note: This can include other providers as wel as a comma separated list.
# Discord auth settings
DISCORD_CLIENT_ID: 'CHANGEME'
DISCORD_CLIENT_SECRET: 'CHANGEME'
# DISCORD_GUILD_ID: '' # (If omitted, any discord user can authenticate)
# DISCORD_ROLE_ID: '' # (If omitted, any user in the specified discord server can authenticate)
# DISCORD_GM_ROLE_ID: '' # (If omitted, all users will be considered GMs)
# DISCORD_ADMIN_ROLE_ID: 'ADMIN_ROLE_ID (If omitted, all users will be considered admins in the API, bypassing all permission restrictions.)'
Once you set this up, run docker compose up -d
again to apply the changes.