Microsoft Graph API访问令牌问题

时间:2020-05-28 20:44:59

标签: azure-active-directory postman azure-ad-graph-api

我在通过邮递员获取访问令牌时遇到问题。

我正在执行此流程“流程2”。 http://codematters.tech/getting-access-token-for-microsoft-graph-using-oauth-rest-api/

“流程1”为我工作。

这是给定的方案。我要发送带有正文的帖子请求。

POST https://login.microsoftonline.com/e0xxxxxx-xxxx-xxxx-xxxx-xxxx09d53164/oauth2/v2.0/token

{

client_id:id

client_secret:秘密

grant_type:密码

用户名:用户

password:pass

scope:openid

}

响应->“ AADSTS90002:找不到租户''。如果租户没有活动订阅,则可能会发生这种情况。

为什么租户填充后会空白?

谢谢您的帮助。

1 个答案:

答案 0 :(得分:0)

您发送的URL错误。此参数不应为AAD_name,而应为tenant

尝试一下:

POST: https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token
Content-Type: application/x-www-form-urlencoded

client_id=xxxxx
&scope=openid
&username=user
&password=pass
&grant_type=password

您可以在App注册中找到您的tenantenter image description here

有关更多信息,您可以看到here


如果要使用{{AAD_name}},则需要先在邮递员中设置Environment

enter image description here

然后,您可以像link所示发送发帖请求。