Api 不和谐的OAuth不停地说无效的授权
这是我的代码。按照discord Said在其文档中所做的操作(可以找到),它应该使用用户访问令牌给出响应。但它给出了无效的授权Api 不和谐的OAuth不停地说无效的授权,api,express,oauth-2.0,discord,Api,Express,Oauth 2.0,Discord,这是我的代码。按照discord Said在其文档中所做的操作(可以找到),它应该使用用户访问令牌给出响应。但它给出了无效的授权 fetch('https://discord.com/api/oauth2/token' , { method: 'post', data:{ 'client_id': CLIENT_ID, 'client_secret': CLIENT_SECRET, 'gr
fetch('https://discord.com/api/oauth2/token' , {
method: 'post',
data:{
'client_id': CLIENT_ID,
'client_secret': CLIENT_SECRET,
'grant_type': 'authorization_code',
'code': code,
'redirect_uri': REDIRECT_URI,
'scope': ['identify','guilds']
},
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
.then(res => res.json())
.then(json => console.log(json));
授权工作正常,并将代码提供给。但当我想获得用户访问令牌时,它会给我这个
{错误:'invalid_grant'}
(代码is=var code=req.query.code;)
(重定向uri与我在链接中所做的相同)