WordPress Discord Integration using OAuth2:
Setting up WordPress Discord Integration (Discord SSO) using OAuth2.0
is easy with WordPress Discord Integrator plugin. It supports advanced Single Sign-On (SSO) features
such as user profile Attribute mapping, Role mapping, etc. Here we will go
through a guide to configure SSO between WordPress and Discord. By the end of
this guide, users should be able to login to WordPress from Discord. To know
more about other features we provide in WP OAuth Single Sign-On ( OAuth &
OpenID Connect Client ) plugin, you can
click here.
Pre-requisites : Download And Installation
- Log into your WordPress instance as an admin.
-
Go to the WordPress Dashboard -> Plugins and click on Add New.
-
Search for a WordPress miniOrange Discord Integration plugin and click on
Install Now.
- Once installed click on Activate.
Steps to configure Discord Single Sign-On (SSO) into WordPress
1. Setup Discord as Social Login Provider
- Go to https://discordapp.com/developers/applications & and sign in with your discord
app developer account.
- Click on New Application.
- After clicking on the New Application button it will show you the popup for providing a name to
the application. Click on the Create button after providing the application name.
- Navigate to the OAuth2 tab from the left section. Click on Add Redirect button
and enter the redirect url which you will get from the WordPress Discord Integration plugin.
Then click on save changes button.
- Now, Copy the Client Id and Client Secret and configure them in the miniOrange Discord Plugin on
the corresponding fields.
You have successfully implemented Discord as Social Login Provider for configuring WordPress Discord Plugin.
2. Setup WordPress as OAuth Client
- Go to Discord login-> App setting. Enter the Client Credentials like Client
ID & Client Secret which you got from step1.
- Enter the scope as identify+email+guilds+guilds.join. Click on save & Test Configuration button.
- You will see all the values returned by discord to WordPress in a table.
You have successfully implemented WordPress as OAuth Client for configuring WordPress Discord Plugin.
3. Setup A discord server
and discord bot into Discord integrator
3.1. Steps to get the Bot Token
- Go to the developer console of discord and Navigate to the Bot tab from left hand side menu. Click on
the
Add Bot button.
- Copy the Token and keep it handy as we will require it later while configuring Bot Token in Discord
Integrator plugin.
3.2. Steps to add the created Bot into discord server
3.3. Steps to get the Guild ID
- To get Guild ID for your server you first need to enable Developer Mode in the discord server
setting. To
Enable Go To Setting => Advanced => Enable Developer Mode.
- Now, Open your Discord server, right-click on the server name, then select Copy ID and keep it handy
as we
will require it later while configuring the Guild ID in the Discord Integrator plugin.
3.4. Steps to configure the Bot Token and Guild ID in the Discord Integrator Plugin
- Now go to Discord Integrator plugin => Discord Server Configuration. And paste Guild ID and
Bot
Token in the Discord Plugin on the corresponding fields.
4. Enable the connect with discord button after the user logged in
Enable this feature to show a "Connect with Discord" button to users after they successfully log in with their
WordPress credentials. By clicking the button, the user will be added to your Discord server.
- Go to Discord Integrator plugin => Link Social Account tab. Enable the checkbox for Linked users to
loggedin user and copy the shortcode [miniorange_discord_login link_enable="1"] and paste it on
any
WordPress page where you want to show connect button.
5. Map Discord roles to WordPress
Member roles in the discord server will be mapped with WordPress role during Single Sign-On (SSO). Whenever a user
logs into the WordPress site using Discord Single Sign-On(SSO), WordPress role will be assigned to the user based on
user's role on the discord server.
- Go to the Discord Integrator plugin => Discord To WordPress Role Mapping tab. Enable the checkbox for
Discord To WordPress Role Mapping.
- Please select the Discord Role corresponding to the desired WordPress Role for a user and proceed by clicking
the Save button. Multiple Discord roles can be assigned to distinct WordPress roles, as shown in the
below image.
6. Map WordPress roles to Discord
User roles from your WordPress site will be mapped to member roles in your Discord server. Whenever a user logs into
the WordPress site using Discord Single Sign-On(SSO), the user will be assigned the Discord role on the discord
server based on user's role on the WordPress website.
- Go to the Discord Integrator plugin => WordPress To Discord Role Mapping tab. Enable the checkbox for
WordPress To Discord Role Mapping.
- Please select the WordPress Role corresponding to the desired Discord Role for a user and proceed by clicking
the 'Save' button. Multiple WordPress roles can be assigned to distinct Discord roles, as shown in the
below image.
7.
Membership/Subscription based Role Mapping
7.1 Woocommerce
Membership based role mapping
Enable this feature, to assign the role to a user on your Discord server based on the membership level purchased
on
your WooCommerce WordPress website. In the event that a user's membership expires or is cancelled, the current
membership-based discord role will be removed and the default discord role will be assigned to that user.
- Go to the Discord Plugin => Membership/Subscription based Role Mapping tab. Here, navigate to
Woocommerce membership tab and enable the Integration by clicking on toggle button.
- Please select the Discord role corresponding to the desired WordPress membership for a user and proceed by
clicking the Save Settings button. It is possible to assign multiple Discord roles to distinct
WordPress
memberships, as shown in the image below.
- Scroll down to the Default_Discord_Role section and select the discord role from the dropdown that
you
want to assign to users as default role. Click on Save Settings below.
7.2 Woocommerce
Subscription based role mapping
Enable this feature, to assign the role to a user on your Discord server based on the Subscription level
purchased on
your WooCommerce WordPress website. In the event that a user's subscription expires or is cancelled, the current
subscription-based discord role will be removed and the default discord role will be assigned to that user.
- Go to the Discord Plugin => Membership/Subscription based Role Mapping tab. Here, navigate to
Woocommerce Subscription tab and enable the Integration by clicking on toggle button.
- Please select the Discord role corresponding to the desired WordPress Subscription for a user and proceed by
clicking the Save Settings button. It is possible to assign multiple Discord roles to distinct
WordPress
Subscription, as shown in the image below.
- Scroll down to the Default_Discord_Role section and select the discord role from the dropdown that
you
want to assign to users as default role. Click on Save Settings below.
7.3 Paid
Membership Pro
based role mapping
Enable this feature, to assign the role to a user on your Discord server based on the membership level
purchased on
Paid Membership Pro. In the event that a user's membership expires or is cancelled, the current
membership-based discord role will be removed and the default discord role will be assigned to that user.
- Go to the Discord Plugin => Membership/Subscription based Role Mapping tab. Here, navigate to
Paid Membership Pro tab and enable the Integration by clicking on toggle button.
- Please select the Discord role corresponding to the desired WordPress membership for a user and proceed by
clicking the Save Settings button. It is possible to assign multiple Discord roles to distinct
WordPress
memberships, as shown in the image below.
- Scroll down to the Default_Discord_Role section and select the discord role from the dropdown that
you
want to assign to users as default role. Click on Save Settings below.
With WordPress Discord Plugin you have configured Discord as Social Login Provider and WordPress as OAuth
Client to provide User Restriction and
Role Mapping for the users who are performing Single Sign-On using Discord user profile on your WordPress site.
Discord Integrator will now provide seamless one-click login with Discord social login into your WordPress site.
Additional Resources
Mail us on
discordsupport@xecurify for
quick guidance(via email/meeting) on your requirement and our team will help
you to select the best suitable solution/plan as per your requirement.