【发布时间】: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)
})
}
})
【问题讨论】:
-
我不是节点专家,但我找到了this documentation。不知道对你有没有帮助
-
我只是从那里复制代码并将其移植到节点,但它不起作用
标签: javascript node.js discord