Discord OAuth SSO Setup
This guide will help you configure Discord as an OAuth provider making Drupal as an OAuth Client. Following these steps will allow you to configure OAuth/OpenID SSO between Discord and your Drupal site such that your users will be able to login to your Drupal site using their Discord credentials.
We provide Drupal OAuth & OpenID Connect Login - OAuth2 Client SSO Login module which is compatible with Drupal 7, Drupal 8, Drupal 9, Drupal 10, and Drupal 11.
Prerequisite:
- Install and activate the OAuth & OpenID Connect Login - OAuth2 Client SSO Login module on your Drupal site. Follow these steps to install the module.
Setup Video:
Steps to configure Drupal as OAuth Client:
-
After installing the module on your Drupal site, navigate to the Configuration tab and click on the miniOrange OAuth Client.

-
In the Manage section, under the Client Configuration tab, click on the + Add New button to configure the desired OAuth Client.

- Provide the following information in the Client Configuration -> Add tab:
- Select Discord from the Select Application dropdown.
- Enter the application name in the Custom App Name text field. For example, Discord.
- Copy the Callback/Redirect URL and keep it handy.

Configure OAuth SSO Application in Discord:
- Login into Discord Developer portal.
-
Select Application from the left navigation panel, and click on New Application button.

- When you click the New Application button, a pop-up appears in which you can input the name of the application in the Name text field.
-
Then, select the checkbox and click on the Create button.

-
Under OAuth2 -> General, click on the Add Redirect button and paste the copied Callback/Redirect URL (from your Drupal site) into the Redirects text field.

- Once done, click on the Save Changes button.
Integrating Drupal with Discord:
-
Navigate to the Discord portal and copy the CLIENT ID from the Client information section.

-
Go to the Drupal site and paste the copied CLIENT ID into the Client ID text field.

- Again back to the Discord portal.
-
Click on the Reset Secret button in the CLIENT SECRET.

-
On the REGENERATE SECRET KEY? popup, click on the Yes, do it! button.

-
Copy CLIENT SECRET from the Client information section by clicking on the Copy button.

-
Navigate to the Drupal site and paste the copied CLIENT SECRET into the Client Secret text field.

-
After you've checked the Scope and Endpoints, click on the Save Configuration button.
-
The Send Client ID and Secret in radio button allow you to specify whether the Client ID and Secret should be included in the header or the body of the Token Endpoint Request. If you're unsure which option to select, you can stick with the default settings.

You can also refer to the Discord Endpoints and Scope from the table given below:
| Scope | identify email |
| Authorize Endpoint | https://discord.com/api/oauth2/authorize |
| Access Token Endpoint | https://discord.com/api/oauth2/token |
| Get User Info Endpoint | https://discord.com/api/users/@me |
Test configuration of Drupal with Discord:
-
After successfully saving your application, click the Perform Test Configuration button to check the connection between Drupal and Discord.

- On a Test Configuration popup, if you don't have an active session in Discord on the same browser, you will be asked to sign in to your Discord account. After successfully logging into the AWS Cognito account, you will be provided with a list of attributes that are received from Discord.
-
Scroll to the bottom and click on the Configure Mappings button.

-
Once you click on the Configure Mapping button, you will be redirected to the Attribute Mapping tab. From there, select the appropriate attribute from the OAuth Server Attribute dropdown where the email value is received, and then click the Save Configuration button.

Please note: Mapping the Email Attribute is mandatory for your login to work.
Congratulations! You have successfully configured Discord as OAuth Provider and Drupal as OAuth Client.
How to perform the SSO login?
- Now, open a new browser/private window and go to your Drupal site login page.
- Click on the Login using Discord link to initiate the SSO from Drupal.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion
