【发布时间】:2019-07-02 01:48:05
【问题描述】:
FE ->(token_a) Middleman ->(token_b) DownstreamServiceA
我的理解是,Middleman要对DownstreamServiceA进行API调用,需要用token_a换取token_b。我试图在邮递员中模拟这种行为。但我无法使用token_a 兑换token_b。我收到以下错误
AADSTS65001: The user or administrator has not consented to use the application with ID '{my-middleman-clientid}'
在 Azure 门户上,我已将 FE API 权限配置为可以访问 DownstreamServiceA 和 Middleman 的公开 API 范围。也代表我的组织用户授予管理员同意。
获取 token_a
POST to https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token
Content-Type: application/x-www-form-urlencoded
grant_type:password
client_secret: foobar
client_id: my-fe-clientid
username: awesome
password: bar
scope: api://{MiddlemanId}/Middleman.All
兑换token_b
POST to https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token
grant_type: urn:ietf:params:oauth:grant-type:jwt-bearer
client_id: my-middleman-clientid
client_secret: foobar
scope: api://{DownstreamServiceAId}/ServiceA.all
assertion: {token_a}
requested_token_use: on_behalf_of
我可以知道我做错了什么吗?我的理解是,我的 FE 需要预先请求并授予 DownStreamServiceA 范围的权限,这是我在 Azure 门户上通过管理员授权完成的。
【问题讨论】:
标签: azure azure-active-directory