Azure AD Graph API - 将令牌范围更改为 User.ReadBasic.All
Azure AD Graph API - Change token Scope to User.ReadBasic.All
如何在 Azure Graph API 的访问令牌上请求 User.ReadBasic.All 范围?我正在尝试向
发出请求
传递以下参数
- client_id (from application in Azure)
- grant_type=password
- resource=https://graph.windows.net
- client_secret (from application in Azure)
- username (username for authorized account)
- password (password for authorized account)
- scope=user.readbasic.all
但是,我取回的令牌将范围显示为 "User.Read",这只允许我读取我在请求中提供的 username/password 用户的个人资料。我需要能够使用此令牌读取任何用户的基本资料。
当我使用我的帐户登录 Graph Explorer 时,我可以阅读我想要的任何用户配置文件。他们发送的是什么我不是?
我在这里错过了什么????
您混淆了 V1 和 V2 端点。在 V2 endpoint 中,我们支持 scope
的查询字符串,它允许您在令牌请求时动态确定您想要的访问令牌范围。
但是,对于 V1 端点,您必须提前配置您尝试调用的 API 所需的权限。
您需要转到您的应用程序的配置,并且select AAD Graph API 的适当权限。 Here is a screenshot 来自 Azure 门户。
如何在 Azure Graph API 的访问令牌上请求 User.ReadBasic.All 范围?我正在尝试向
发出请求传递以下参数
- client_id (from application in Azure)
- grant_type=password
- resource=https://graph.windows.net
- client_secret (from application in Azure)
- username (username for authorized account)
- password (password for authorized account)
- scope=user.readbasic.all
但是,我取回的令牌将范围显示为 "User.Read",这只允许我读取我在请求中提供的 username/password 用户的个人资料。我需要能够使用此令牌读取任何用户的基本资料。
当我使用我的帐户登录 Graph Explorer 时,我可以阅读我想要的任何用户配置文件。他们发送的是什么我不是?
我在这里错过了什么????
您混淆了 V1 和 V2 端点。在 V2 endpoint 中,我们支持 scope
的查询字符串,它允许您在令牌请求时动态确定您想要的访问令牌范围。
但是,对于 V1 端点,您必须提前配置您尝试调用的 API 所需的权限。
您需要转到您的应用程序的配置,并且select AAD Graph API 的适当权限。 Here is a screenshot 来自 Azure 门户。