2017-08-14 108 views
0

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执行相同的确切呼叫时,它会按预期工作。

+0

也许有关? https://stackoverflow.com/questions/34767672/issue-with-getting-groups-conversation –

回答

1

AFAIK,正如@Marek Rycharski在该帖子中所说,群组对话访问在应用程序专用授权流程中不受支持。

在我的测试中,我使用的客户机凭证流获取应用程序只令牌用于Microsoft图表,所不同的是我的客户端证书是口令,和接入令牌包括Group.ReadWrite.All应用许可,执行/v1.0/groups/{group-ID}/conversations操作,则响应示出了当403禁止的错误。但是使用授权代码流来获取具有委托权限的访问令牌,列表会话操作正常。