AccessDenied,scp或角色要求在令牌中存在

时间:2019-04-22 07:39:03

标签: azure sharepoint postman microsoft-graph

使用此URI,我试图生成访问令牌

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

并且访问令牌已成功生成。

我正在传递client_id,client_secret,grant_type和作用域。

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

当我尝试通过执行以下呼叫访问该网站

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

使用这些访问令牌,出现以下错误: “ AccessDenied,scp或角色要求在令牌中存在。”

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

为了访问该站点并以application / json格式获取列表,请提出在令牌中声明角色要求的内容?

1 个答案:

答案 0 :(得分:0)

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

enter image description here

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

enter image description here

  

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

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

enter image description here

相关问题