Ask*_*ous 2 httprequest node.js oauth-2.0 npm-request microsoft-graph-api
我grant_type按照文档所示将参数放入请求正文中,但 Microsoft Graph 仍然抱怨它不存在;
const tokenRequestBody = [
"grant_type=client_credentials",
"scope=https%3A%2F%2Fgraph.microsoft.com%2F.default",
`client_secret=${config.appClient.password}`
].join("&");
request.post(
{
url: tokenRequestUrl,
json: true,
headers: {
"content-type": "application/application/x-www-form-urlencoded"
},
body: tokenRequestBody
},
(err, req, body) => {
console.log(body.error_description);
// Logs: The request body must contain the following parameter: 'grant_type'.
}
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7847 次 |
| 最近记录: |