繁体   English   中英

Azure 登录到多租户 AD 应用程序失败

[英]Azure login to multi-tenant AD app failing

我在租户 A 中有用户 A,在租户 B 中有一个多租户 AD 应用程序 B。我正在尝试从用户 A 的 AD 应用程序上下文中获取令牌

https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=a573ddda-b34a-4206-a73b-d67ff6e98aec&response_type=token&redirect_uri=http%3A%2F%2Flocalhost%2Fmyapp%2F%2Flocalhost%2Fmyapp%2 4206-a73b-d67ff6e98aec%2F.default&response_mode=fragment&state=12345&nonce=678910

我使用用户 A 的凭据登录并出现错误

AADSTS700016: Application with identifier 'a573ddda-b34a-4206-a73b-d67ff6e98aec' was not found in the directory 'domainA.onmicrosoft.com'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant.

我已将 ID 为 a573ddda-b34a-4206-a73b-d67ff6e98aec 的 AD 应用程序 B 配置为多租户。 知道为什么这可能不起作用吗?

正如@juunas 提到的,如果您使用来宾用户登录,请使用租户 A 的tenant id而不是common ,它将强制用户针对租户 A 而不是他的主租户进行身份验证。

如果您的访客用户是第一次登录应用程序,请确保租户 A 中的某些设置如下所示,否则,用户将无法同意租户 A 中的应用程序。

  1. 导航到租户 A 中的Azure Active Directory -> User settings -> Manage external collaboration settings -> 将Guest users permissions are limitedNo

在此处输入图像描述

  1. 导航到租户 A 中的Azure Active Directory -> Enterprise applications -> User settings -> 将Users can consent to apps accessing company data on their behalf设置为Yes

在此处输入图像描述

有关成员用户和来宾用户的更多详细信息,请参阅此https://docs.microsoft.com/en-us/azure/active-directory/fundamentals/users-default-permissions

我遇到了由完全不同的因素引起的相同错误:我使用Secret ID和 Secret Value 而不是App ID和 Secret Value 配置了 Oauth2 客户端。

浏览大量配置页面花了几个小时才发现原因非常简单,MS API 的响应毫无用处。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM