使用 OAuth 2.0 配置 Azure APIM 应用程序,这将使用 JWT 令牌保护 API

问题描述 投票:0回答:1

我有 Azure APIM 应用程序,其中配置了“OAuth 2.0 + OpenID Connect”>“OAuth 2.0”>“添加”> 我已添加所有必需的详细信息。

此处添加的授权和令牌端点取自我的 Azure AD B2C 租户 > 应用程序注册 > 我已添加一个应用程序注册(我已添加登录和注册默认推荐用户流程)> 端点(与注册和登录策略链接) ).

一切看起来都很完美,但是当我测试 API 时,当我选择授权流程 > 授权代码 > 它将打开一个弹出窗口 > 由于我已经在此处登录到 APIM 应用程序,它会自动登录并再次显示 APIM 应用程序主屏幕弹出窗口。

理想情况下,它应该在标头中添加不记名令牌作为授权标头。但它没有按预期工作。

如果我遗漏了什么,请告诉我。

azure oauth-2.0 azure-api-management bearer-token apim
1个回答
0
投票

我已通过以下方式在我的 APIM 实例中配置了 OAuth 2.0 -

enter image description here enter image description here enter image description here

  • 您需要在注册的应用程序中添加授权码授予流程 URL,如下所示。

enter image description here

  • 进行这些更改后,我发布了开发者门户。这里我还没有启用Azure AD。

enter image description here

  • 当我在授权中选择authorization_code时,就会弹出登录页面。

enter image description here

  • 登录成功后,我可以看到标题中的令牌已修改。

enter image description here

  • 我能够得到 200 OK 响应。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.