Duplicate token found - Discord login

Receiving Could not get result from torus nodes Duplicate token found error when using Custom verifier for Discord.

  • This is because Discord issues the same token for 30 mins.
  • We revoke it for you for default verifiers( such as when using Web3Auth Modal @webauth/modal).
  • But when using Custom Verifier for Discord, the integrating dApps have to revoke the token themself before attempting the next login by using discord clientId and the secret to revoke the token.

Here’s the sample code to revoke the token:

const axios = require("axios").default;
const FormData = require("form-data");

const { token } = req.body;
const formData = new FormData();
formData.append("token", token);
await axios.post("https://discord.com/api/oauth2/token/revoke", formData, {
  headers: {
    Authorization: `Basic ${Buffer.from(`${DISCORD_CLIENT_ID}:${DISCORD_CLIENT_SECRET}`, "binary").toString("base64")}`,

Thank you @shahbaz! Any idea on how we get the Discord token before sending it to the backend? Thank you!