I was coding a basic program in JavaScript using axios and express to learn more about how OAuth2 worked when my client All of the sudden gave an error.
This is the part of the code it errors on.
//^^^^^^^^^^
// defining web server
const formData = new url.URLSearchParams({
client_id: webid,
client_secret: websecret,
grant_type: 'authorization_code',
code: code.toString(),
redirect_uri: redirect_uri,
});
const oauthInfo = await axios.post('https://discord.com/api/v10/oauth2/token',
formData, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
}
});
// below is starting everything
Full code: https://pastebin.com/FbHVkKRi
New contributor
Gir0fa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.