Configure Discord Login for Discourse

Discourse supports authentication via Discord. Once enabled and configured, login with Discord will appear alongside the other login methods for your forum:


To get started, head over to Discord developer portal and create a new application. Choose a name, icon and description of your choice. These will be shown to users during the login flow.

Copy the Client ID and Client Secret from this screen, and enter them into your Discourse settings under discord_client_id and discord_client_secret.

Next, visit the OAuth2 tab on the left. Under Redirects, enter your Discourse site URL (including https://), followed by /auth/discord/callback (No trailing slash!). Make sure you hit Save Changes before closing the window. Don’t worry about using the ‘OAuth2 URL Generator’ - Discourse will handle that automatically.

Finally, go back to your Discourse site and enable the enable_discord_logins site setting. You should now have a working Discord login button on your site :tada:

Restricting access by Guild

By default, any Discord user can log into your Discourse forum. To restrict access to specific guilds, you can use the discord_trusted_guilds site setting.

First of all, find out the numeric ID for your Discord guild. The easiest way is to login to your guild and open a random channel. Check the URL in your browser, and copy the first number you see in it. The URL format is{guild}/{channel}. For example, given a URL as, your guild ID would be 123.

Once you have the guild ID, add it to the discord_trusted_guilds setting in your Discourse site settings. You can add as many guilds to this list as you like. Now, users in the trusted guilds will be logged straight into your site. Anyone else will be shown this message when they try and get in. You can modify the message from your admin panel by searching for discord.not_in_allowed_guild under CustomizeText.

If you are relying on this guild restriction for security, make sure to disable all other Discourse login methods.

What next?

Now that your users can login with Discord, how about setting up the chat-integration plugin as well? That will push important topics from Discourse straight into your Discord channels. For more information, check out the chat-integration setup information.

Last Reviewed by @AlexDev on 2022-05-25T23:00:00Z


Thanks for the post. I was trying to disable discord oauth
I already removed plugin from app.yml and after the rebuild it keeps asking me to login via discord

Discord login is no longer just a plugin, it’s part of core code now, check your site settings.

@merefield Yes, before I disabled authentication via email and only enabled discord auth. Now I’m trying to disable discord auth and enable email authentication

The issue is I cannot login using discord now so cannot access admin panel. There might be possible solution using cli and it would be great if you can guide me how to do that

I believe the [YourSite]/u/admin-login link should bypass this, if you could give that a try.

1 Like

I tried and it says unknown email address

Can you ssh into the instance, enter the container, open the rails console and amend the settings there?

1 Like

I can enter the container. Which rails command should I use?

./launcher enter app
rails c
irb>SiteSetting.<my_setting> = <my_value>
1 Like