我尝试使用此 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 中的角色声明?
最佳答案
配置权限后,您需要点击授予管理员同意按钮。
您可以通过解码访问 token 来检查 token 是否具有权限。
When I tried to check https://jwt.io/#encoded-jwt I found that its an Invalid signature.
您可以将算法更改为 HS256 来解决此问题。
关于azure - AccessDenied,scp 或角色声明需要出现在 token 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55790865/