允许 Azure 多租户 ADB2C 中的 API 被另一个租户客户端应用程序使用

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

我正在开发 .net web api 并响应应用程序项目并在 azure 不同租户中注册;

Azure Active Directory B2C (ADB2C)

Tenant A:
Web API 项目

Tenant B:
React Client App1(需要使用租户 A 的 API)

Tenant C:
React Client App2(需要使用租户 A 的 API)

我无法在 API 权限下看到租户 B / C 中的 API,并卡在此处..

Tenant A
:我有
scope

https://MyMachine.onmicrosoft.com/api/xxx/Core.API.All

然后在租户 A 下; API 权限 --> 我为 API 添加了“应用程序权限”

In Manifest
我看得见

"signInAudience": "AzureADMultipleOrgs",

我所有租户都有相同的

owner

我还需要做什么才能让租户 A 的 API 可以在租户 B 和 C 上访问

我已经创建了要求我授权的同意网址,但我仍然无法在 API 权限下的租户 B/C 中看到 Core.API.All

https://login.microsoftonline.com/{TenantA TenantID}/adminconsent?client_id={TenantB : ClientID}&redirect_uri=http://localhost:3000/auth-callback
reactjs asp.net-core-webapi azure-ad-b2c multi-tenant
1个回答
0
投票

TenantA
中,我创建了一个多租户应用程序并公开了一个API,添加了范围:

enter image description here

已授予API权限:

enter image description here

要将此

TenantA
作为
TenantB
中的企业应用程序,请运行以下命令并使用
TenantB
用户登录:

https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize?client_id=TenantAWebProjecttAppID&response_type=code&redirect_uri=https://jwt.ms&response_mode=fragment&scope=https://b2caadtenant.onmicrosoft.com/xxx/Core.API.All&state=12345

enter image description here

将在

TenantB
中创建企业应用程序。要向
TenantB
中的企业应用程序授予 API 权限,请运行以下命令并登录
TenantB
用户:

https://login.microsoftonline.com/organizations/adminconsent?client_id=TenantAWebProjecttAppID

enter image description here

TenantB
中,企业应用程序现在已授予权限:

enter image description here

现在在

TenantB
中创建应用程序并添加
TenantAWebProjectt
的API权限,如下所示:

enter image description here

现在

TenantB
客户端应用程序将能够使用来自
TenantA
的 API,并对
TenantC
执行相同操作。

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