this code returns me this: {"error": "unsupported_grant_type", "error_description": "Grant type None is not supported"}. What am i doing wrong?
app.get('*', (req,res) => {
res.sendFile(__dirname + "/test.html")
console.log(req.query.code)
const Body = {
client_id: "870076989682360330",
client_secret: "my secret",
code: req.query.code,
redirect_uri: "http://localhost:3000",
grant_type: "authorization_code",
scope :"scope"
}
if(req.query.code) {
reqst.post({
uri: "https://discord.com/api/oauth2/token",
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: JSON.stringify(Body)
}, (x,y,z) => {
console.log(z)
})
}
})
Do you have scopes? if not try adding scopes and if yes you can check this Discord Ouath2 Access Token 'Grant type None is not supported' and discord docs https://discord.com/developers/docs/topics/oauth2#authorization-code-grant