Discord Social Login with Magic
Discord Social Login with Magic
#Overview
You can allow your users to sign up & log in to your web app with their Discord account.
#Usage
#Prerequisites
- You will need a Discord account
- You will need to have the Magic SDK installed into your web app
- You will need to have the Magic SDK - OAuth Extension installed into your web app
#Discord Setup (v1 extension)
After installing the OAuth extension, you can now enable GitHub Login for your Magic app:
- Create a Discord API application
- Go to your Magic Dashboard
- Select the Magic app for which you’d like to enable Discord Login, or create a new app
- Navigate to Social Login from the sidebar
- Click the toggle for Discord
- Copy the Redirect URI field from your Magic Dashboard
- Return to your Discord developer Dashboard, navigate to OAuth2 from the sidebar, and paste the Redirect URI you obtained from your Magic Dashboard into the "Redirect URI" field. Don't forget to save your changes!
- Next, obtain the "Client ID" and "Client Secret" from the current page
- Return to your Magic Dashboard and input the Client ID and Client Secret for your Discord OAuth app
- In Magic Dashboard, click “Save” – Done!
#Discord Setup (v2 extension)
- Follow above steps, but disregard Magic's Redirect URI in step 6
- In step 7, paste the Redirect URI you are passing in as the redirectURI argument to the loginWithRedirect method
Javascript
01await magic.oauth2.loginWithRedirect({
02 provider: 'discord',
03 redirectURI: 'https://your-app.com/your/oauth/callback', // <== whitelist this with Discord
04});