Archived Content from Web3Auth Community
This topic was originally posted by githubdiscussions on 8/1/2022.
This content has been migrated from our previous community forum to preserve valuable discussions.
When I login through Discord, I can only login once in 30mins and it shows an error afterwards.
Originally posted by:
yashovardhan Check the discussion at:
https://github.com/orgs/Web3Auth/discussions/300
Web3Auth requires a new token for every login attempt. Unfortunately, Discord returns the same access token for 30 min unless it is revoked. Unfortunately, it needs to be revoked from the backend since it needs a client secret. Here's some sample code which does it:
https://discord.com/api/oauth2/token/revoke", formData, {
headers: {
…formData.getHeaders(),
Authorization:
Basic ${Buffer.from(${DISCORD_CLIENT_ID}:${DISCORD_CLIENT_SECRET}
, "binary").toString("base64")},
},
});">
const axios = require(“axios”).default;
const FormData = require(“form-data”);
const { DISCORD_CLIENT_SECRET, DISCORD_CLIENT_ID } = process.env;
const { token } = req.body;
const formData = new FormData();
formData.append(“token”, token);
await axios.post(“https://discord.com/api/oauth2/token/revoke”, formData, {
headers: {
…formData.getHeaders(),
Authorization: Basic ${Buffer.from(${DISCORD_CLIENT_ID}:${DISCORD_CLIENT_SECRET}, "binary").toString("base64")},
},
});
Originally posted by:
YZhenY