【发布时间】:2019-05-08 15:07:52
【问题描述】:
上下文:我有一个控制台应用程序,它想使用 Graph API 与 AAD 对话,以检查租户中是否存在特定的 userId。
我一直在遵循这里的准则:https://docs.microsoft.com/en-us/graph/auth-v2-service?view=graph-rest-1.0
我可以使用这个生成一个令牌:
https://login.microsoftonline.com/common/oauth2/v2.0/token
client_id=x
&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default
&client_secret=x
&grant_type=client_credentials
但是当我调用图形 API 时,我得到了这个错误:
https://graph.microsoft.com/v1.0/users/12345678-73a6-4952-a53a-e9916737ff7f
{
"error": {
"code": "Authorization_RequestDenied",
"message": "Insufficient privileges to complete the operation.",
"innerError": {
"request-id": "x",
"date": "x"
}
}
}
我的 AAD 应用拥有以下所有权限:
1. Microsoft Graph
2. Windows Azure Active Directory
我尝试将范围更改为
scope=https%3A%2F%2Fgraph.microsoft.com%2Fuser.read
但这是我在生成令牌时遇到的错误:
The provided value for the input parameter 'scope' is not valid. The scope https://graph.microsoft.com/user.read is not valid.
我尝试了“User.Read”、“User.Basic.Read”等的组合,但没有任何效果。
【问题讨论】:
标签: azure-active-directory azure-ad-graph-api