获取令牌调用 Microsoft Graph REST Api 给出 400 错误

Get Token call to Microsoft Graph REST Api gives 400 error

我能够通过 Graph Explorer 连接到 MS Graph API,并使用 C# 中的 SDK。但是,当我在 Postman 中使用与 SDK 相同的信息时,出现 400 错误。我正在发布到 https://login.microsoftonline.com/TENANTID/oauth2/v2.0/token HTTP/1.1 (使用我们的租户 ID)并使用 x-www-form-urlencoded 发送:

响应始终是 404。

我在 Microsoft (https://docs.microsoft.com/en-us/graph/auth-v2-service#token-request) 的获取令牌请求调用中基于此,所以我不确定为什么它不起作用。任何帮助将不胜感激。

好的...我对 MS 站点上的格式感到困惑:

POST https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token HTTP/1.1 主持人:login.microsoftonline.com 内容类型:application/x-www-form-urlencoded

我正在尝试 post 到 https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token HTTP/1.1

当我需要 post 到 https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token