在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 –