azure - AccessDenied,scp 或角色声明需要出现在 token 中

标签 azure sharepoint postman microsoft-graph-api

我尝试使用此 URI 生成访问 token

https://login.microsoftonline.com/<tenant_id>/oauth2/v2.0/token

并且访问 token 已成功生成。

我正在传递 client_id、client_secret、grant_type 和范围。

当我尝试检查https://jwt.io/#encoded-jwt时我发现它的签名无效。

当我尝试通过执行以下调用访问此网站时

https://graph.microsoft.com/beta/sites/<tenant_id>/lists

使用这些访问 token 我收到以下错误: “AccessDenied,scp 或角色声明需要出现在 token 中。”

{
    "error": {
        "code": "AccessDenied",
        "message": "Either scp or roles claim need to be present in the 
                    token.",
        "innerError": {
            "request-id": " ",
            "date": " "
        }
    }
}

为了访问该网站并获取 application/json 格式的列表,请建议应包含哪些内容来获取 token 中的角色声明?

最佳答案

配置权限后,您需要点击授予管理员同意按钮。

enter image description here

您可以通过解码访问 token 来检查 token 是否具有权限。

enter image description here

When I tried to check https://jwt.io/#encoded-jwt I found that its an Invalid signature.

您可以将算法更改为 HS256 来解决此问题。

enter image description here

关于azure - AccessDenied,scp 或角色声明需要出现在 token 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55790865/

相关文章:

reactjs - 尝试使用 Microsoft Graph API + React-adal 获取用户个人资料照片时出现 "NoPermissionsInAccessToken"

wcf - SharePoint Foundation 2010 中的 SVC 给出 HTTP 400 : Bad Request

regex - 修剪或替换 PowerShell 字符串变量

azure - 在组织中的 Office 365 上发布 Office 加载项

postman - 是否可以使用 htmlextra 或类似的东西生成 Postman Collection 运行的 HTML 报告,而无需通过 newman 运行?

azure - Azure 存储 CDN 和 CORS 问题

azure - 当您无法使确切的排队消息出队时,QueueTriggerAttribute 有什么用呢?或者你可以吗?

asp.net - 在 postman 中发送实体模型

azure - 非分区流分析作业输出

Windows 上的 Postman 应用程序 : Unable to see application menu and update tab on settings dialog