[英]How to get rid of 400 bad request error in simple-oauth2 getToken method?
I am trying to create an application where i want to fetch Outlook mails.我正在尝试创建一个我想要获取 Outlook 邮件的应用程序。 I am using using simple OAuth 2.0 for the access token.
我正在使用简单的 OAuth 2.0 作为访问令牌。 I am successfully getting the code.
我已成功获取代码。 When I am trying to get the access token in exchange of code I am getting 400 bad request error.
当我尝试获取访问令牌以交换代码时,我收到 400 错误请求错误。
const tokenConfig = {
code: auth_code,
redirect_uri: redirectUri,
scope: scopes.join(' ')
};
try {
const result = await oauth2.authorizationCode.getToken(tokenConfig);
const accessToken = oauth2.accessToken.create(result);
} catch (error) {
console.log('Access Token Error', error.message);
}
Can you help what wrong I am doing.你能帮我做错什么吗。 Please comment for more information.
请发表评论以获取更多信息。
For me the solution was to set ModuleOptions.options.authorizationMethod
to 'body'
:对我来说,解决方案是将
ModuleOptions.options.authorizationMethod
设置为'body'
:
const oAuthConfig = {
client: {
id: 'xxxxxxxxxx',
secret: 'xxxxxxxxxxxxxxxx'
},
auth: {
tokenHost: 'https://oauthhost.example.com/common/',
tokenPath: 'authtokenserver/token',
authorizePath: 'authtokenserver/authorize'
},
options: {
authorizationMethod: 'body'
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.