我创建了一个新的 Angular 项目并设置了 MSAL (@azure/msal-angular
)。
当我转到 MsalGuarded 路线时,它会正确重定向我进行登录。但是,在提供我的凭据后,我收到一条错误消息:
We're unable to complete your request
unauthorized_client: The client does not exist or is not enabled for consumers. If you are the application developer, configure a new application through the App Registrations in the Azure Portal at https://go.microsoft.com/fwlink/?linkid=2083908.
在 Azure 门户上,我使用重定向 URI http://localhost:4200 注册了 SPA(单租户),因为我不希望为消费者启用它。
我尝试启用/禁用隐式授予,但没有帮助(而且无论如何也不应该为 OAuth2/OpenID Connect 启用它)
我的问题是:是否可以注册单租户 SPA?或者单一租户只与私有(private)客户合作?
最佳答案
这取决于您是否要将 spa 应用程序公开给其他帐户。如果您使用https://login.microsoftonline.com/common/
,则表示它接受任何帐户,那么您需要选择我的应用程序,然后转移到身份验证选项卡,然后在支持的帐户类型下,选择任何组织目录中的帐户(任何 Azure AD 目录 - Multi-Tenancy )。
如果您想将 spa 应用程序限制为该租户使用,即不向其他租户公开,您可以尝试 https://login.microsoftonline.com/tenant id/
或 https://login.microsoftonline.com/organizations/
登录。
关于angular - 如何在 Azure AD 上注册单租户 SPA?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66087813/