【发布时间】:2019-11-19 02:22:30
【问题描述】:
我想从 Postman 生成 Azure 令牌以在我的项目中进行 API 授权。我能够使用以下 API 请求生成令牌,但在另一个 API 请求中使用生成的令牌时收到以下错误消息“Authorization denied for this request”。
端点#
https://login.microsoftonline.com/:tenant_id/oauth2/token
参数#
tenant_id:As per id generation by azure.
正文#(表单数据)
grant_type:client_credentials
client_id:As per id generation by azure.
client_secret:As per id generation by azure.
resource:Required URL
响应#
"token_type": "Bearer",
"expires_in": "foo",
"ext_expires_in": "foo",
"expires_on": "foo",
"not_before": "foo",
"resource": "foo",
"access_token":foo
由于不接受上述返回的令牌,我在请求正文中也传递了用户名和密码,但最终得到了相同的结果。即使它们是错误的,azure 也没有考虑我的凭据。
能否请您协助我在响应中还需要发送什么来获取有效的令牌 ID?
【问题讨论】:
-
查看更新的答案并完全按照我的说明进行操作。你肯定会得到令牌。如果您还有其他问题,请告诉我
-
我按照您的指示申请并成功获取令牌,但问题是生成的令牌在传递到另一个 API 以进行身份验证时不被接受为有效令牌。
-
你在哪里传递这个?您尝试访问哪个资源?显示网址
-
POST>>>login.microsoftonline.com/<<My 租户名称>>.microsoft.com/oauth2/token。发送这些inbody(授权类型、clientid、client_secret 和资源)
-
这是token端点,拿到token后你在哪里传呢?不是这个网址
标签: azure azure-active-directory postman access-token bearer-token