在Node.js脚本使用adal-node,我试图检索this official documentation部分的组对话。Microsoft Graph API:获取组对话时出现“403禁止”错误
我创建了一个应用程序在Azure的AD管理我的房客,并临时检查图形API(应排除“丢失许可”的问题),然后点击了“授予权限所有权限“按钮。
我正在使用证书进行身份验证。
基本上我做:
var adal = require('adal-node');
var authorityUrl = 'https://login.windows.net/{my-tenant}';
var context = new adal.AuthenticationContext(authorityUrl);
context.acquireTokenWithClientCertificate(
'https://graph.microsoft.com',
'{my-app/client-ID}',
'{certificate file content}',
'{certificate thumbprint}',
function(err, tokenResponse) {
// this method does an HTTPS call with autorization token & returns results (uses 'https.request()')
callRestApi(
'graph.microsoft.com', // host
443, // port
'/v1.0/groups/{group-ID}/threads', // path
'GET', // method
tokenResponse.accessToken, // token
function(err, results) {
console.log(err);
console.log(results);
});
});
当我使用的,例如,作为/v1.0/groups/{group-ID}/description
路径,它按预期工作。
然而,随着/v1.0/groups/{group-ID}/conversations
或/v1.0/groups/{group-ID}/threads
,我总是得到一个HTTP 403 /禁止错误(没有在任何response.headers进一步详细)。
请注意,当我尝试使用我的租户管理员帐户从online Graph API Explorer执行相同的确切呼叫时,它会按预期工作。
也许有关? https://stackoverflow.com/questions/34767672/issue-with-getting-groups-conversation –