Add an OpenID Connect with Discord IdP
On this page
Add a Login with Discord button to the FusionAuth login pages. FusionAuth connects to Discord through the OpenID Connect Identity Provider. After you configure the Identity Provider, you can enable the button for one or more Applications.
The following login page shows the Discord button:

The following diagram shows a login through Discord on the FusionAuth hosted login pages:
A user logs in through an Identity Provider on the FusionAuth hosted login pages.
The user sees only the FusionAuth login page, the login page of Discord, and your application. Your application completes a standard OAuth authorization code grant with FusionAuth, and FusionAuth handles the exchange with Discord.
For more information about Discord OAuth, see Discord OAuth2.
Register a Discord OAuth2 Application#
-
Log in to the Discord Developer Portal, and create an application.
-
In the left navigation, open Selected App -> Settings -> OAuth2 .

-
Add the redirect URLThe URL where the authorization server sends the browser after login, with an authorization code or an error. of FusionAuth, which is the FusionAuth URL followed by
/oauth2/callback. For FusionAuth athttps://login.piedpiper.com, the redirect URL ishttps://login.piedpiper.com/oauth2/callback. -
Copy the
CLIENT IDand theCLIENT SECRET. The FusionAuth Identity Provider needs both values.
Configure the OpenID Connect Identity Provider#
-
In the Admin UI, navigate to Settings -> Identity Providers , and add an OpenID Connect Identity Provider. For the full add steps, see Add an OpenID Connect IdP.
-
Set Client Id and Client secret to the
CLIENT IDandCLIENT SECRETvalues from Discord. -
Set Button text to
Login with Discord. -
Turn off Discover endpoints. Discord documents the user fields of the
/users/@meendpoint, not the userinfo endpoint in the Discord discovery document. Enter the following endpoints:- Authorization endpoint:
https://discord.com/oauth2/authorize - Token endpoint:
https://discord.com/api/v10/oauth2/token - Userinfo endpoint:
https://discord.com/api/v10/users/@me
- Authorization endpoint:
-
Set Scope to
identify email. -
Set Client authentication to
Request body (client_secret_post). Discord also acceptsHTTP basic authentication (client_secret_basic). -
On the Options tab, set Unique Id claim to
idand Email verified claim toverified. Discord doesn't use the standard claim names. Withoutverified, FusionAuth links on Discord email addresses that Discord hasn't verified. For more information, see Options.
-
On the Applications tab, turn on Enabled for each Application that offers Discord login. To register new users for an Application, turn on Create registration.
-
Click .
The login page of each enabled Application then shows the Login with Discord button.
The following image shows the top of a Discord Identity Provider configuration:

The following image shows the Applications tab, with the Identity Provider enabled for the PiperChat Application and Create registration turned on:

Add Discord Profile Data#
The Discord implementation of OpenID Connect doesn't follow the full specification. To add more profile data to the user, such as the Discord username and the avatar URL, set a Reconcile lambda on the Identity Provider. For more information, see the OpenID Connect reconcile lambda.
Related
Learn how to add an Epic Games login button to the FusionAuth login pages.
Learn how to add a Nintendo login button to the FusionAuth login pages.
Learn how to add a Sony PlayStation Network login button to the FusionAuth login pages.
Learn how to add a Steam login button to the FusionAuth login pages.