【问题标题】:Microsoft Graph API : "403 forbidden" error when getting groups conversationsMicrosoft Graph API:获取组对话时出现“403 禁止”错误
【发布时间】:2017-08-14 11:35:14
【问题描述】:

在使用adal-nodeNode.js 脚本中,我试图检索this official documentation 部分之后的群组对话。

我在 Azure AD 管理 中为我的租户创建了一个应用程序,并临时检查了 Graph 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 / Forbidden 错误(response.headers 中没有任何进一步的详细信息)。

请注意,当我尝试使用我的租户管理员帐户从 online Graph API Explorer 进行完全相同的调用时,它会按预期工作。

【问题讨论】:

标签: office365 azure-active-directory microsoft-graph-api


【解决方案1】:

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

在我的测试中,我使用客户端凭证流来获取 microsoft graph 的 app-only 令牌,不同的是我的客户端凭证是密码,并且访问令牌包括 Group.ReadWrite.All 应用程序权限,在执行 /v1.0/groups/{group-ID}/conversations 操作时,响应显示 403 Forbidden error 。但是使用授权代码流来获取具有委托权限的访问令牌,列表对话操作可以正常工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-03-15
    • 2021-01-28
    • 1970-01-01
    • 2020-07-31
    • 2022-07-15
    • 1970-01-01
    • 2019-08-07
    • 1970-01-01
    相关资源
    最近更新 更多