Set up Discord Authentication
Set up your Discord App
- Create a new application in the Discord Developer Portal (opens in a new tab).
- Navigate to the OAuth2 tab in the sidebar, and Obtain the OAuth Client ID and Client secret from the Client Information section.
- Add your redirect URIs in the fields labelled “Add Redirects” (e.g.: http://localhost:3000 (opens in a new tab)).
- In the OAuth2 URL Generator section, select identify and email as the scope.
Set up your Kaiju Developer Portal
- Sign in to the Kaiju Developer Portal (opens in a new tab).
- After successfully logging in create a new project.
- Fill out the fields and click the "Create Project" button.
- Navigate to the 'Settings' tab in the sidebar and obtain the Access Key.
- Click on the “Custom Authentication” tab at the top, then click the “New Verifier” button to set up a new custom verifier.
- Enter the desired name for the “Verifier identifier” (e.g.: discord-verifier).
- Choose "Social login providers" as the login provider.
- Select "Discord" as the login provider.
- Paste the Client ID obtained from the Discord App (above) into the Client ID field.
- Click the "Create verifier" button to obtain the verifier ID.
Setup the project
-
Open the terminal and clone the repository at,
https://github.com/kaiju-web3-labs/kaiju-wallet-integration-samples (opens in a new tab) -
Navigate to project “discord-login”.
cd discord-login\next-js
-
Install node_modules.
yarn install
-
Update the .env file.
-
Navigate to the .env file in the project folder and replace the obtained client ID, Client secret, access key and verifier ID as follows:
Run the project
-
Run the project.
yarn dev
-
Login with Discord, and you will navigate to the home page. You can see your wallet details and can do a transaction from there.
ℹ️
At login, the application receives the user Access Token (User Token) and passes it to the getWallet and signTransaction APIs.
Also check the Login Flow , Transaction Flow and Go to Live .