【问题标题】:Discord api grant type None is not supportedDiscord api 授权类型 不支持 None
【发布时间】:2022-01-08 07:38:12
【问题描述】:

这段代码返回给我这个:{"error": "unsupported_grant_type", "error_description": "Grant type None is not supported"}。我做错了什么?

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)
    })

}

})

【问题讨论】:

标签: javascript node.js discord


【解决方案1】:

你有瞄准镜吗?如果不是,请尝试添加范围,如果是,您可以查看此Discord Ouath2 Access Token 'Grant type None is not supported' 和不和谐文档https://discord.com/developers/docs/topics/oauth2#authorization-code-grant

【讨论】:

  • 文档说在获取有关用户的数据时不需要范围,是的,我在登录时有范围标识
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-07-01
  • 2017-05-14
  • 2017-09-18
  • 1970-01-01
  • 1970-01-01
  • 2015-05-28
相关资源
最近更新 更多