简体   繁体   English

Angular Azure B2C SSO问题

[英]Angular Azure B2C SSO issue

Context: I have an MVC application, which uses OWIN, and connects to Azure for authentication. 上下文:我有一个MVC应用程序,该应用程序使用OWIN,并连接到Azure进行身份验证。 It stores a token in the cookie. 它将令牌存储在cookie中。

I have another application that is an angular spa application. 我还有另一个应用程序,它是一个角度水疗中心应用程序。 This also connects to Azure for authentication. 这也连接到Azure进行身份验证。 It stores the token in localstorage. 它将令牌存储在本地存储中。 (msal library) (资料库)

Issue: When I login to the MVC app first and open the spa app and click on login it again asks for credentials and vice versa. 问题:当我第一次登录MVC应用程序并打开spa应用程序并单击登录时,它再次要求提供凭据,反之亦然。 This is due to different storage I believe. 我相信这是由于不同的存储。

Question : How can the above issue be resolved? 问题:上述问题如何解决? If it's not possible, is there any other js library that will allow me to solve this? 如果不可能,是否还有其他js库可以让我解决这个问题?

Other inputs: Msal silent token works on local storage, no issue on that. 其他输入:Msal静默令牌可在本地存储上使用,对此没有问题。

Make sure you register both applications under your B2C tenant. 确保您在B2C租户下都注册了两个应用程序。 You can test your storage theory easily by publishing another MVC application and seeing if the SSO works between that application and your existing one. 您可以通过发布另一个MVC应用程序并查看SSO是否在该应用程序和现有应用程序之间正常工作来轻松测试您的存储理论。

Whether it's a single page angular application or an MVC application shouldn't affect whether the user can SSO into both of them. 无论是单页角度应用程序还是MVC应用程序,都不应影响用户是否可以将SSO集成到这两个应用程序中。 Ensure that the user is added in your AAD and if you want to be on the safe side you can add the user manually to both application. 确保将用户添加到您的AAD中,如果您出于安全考虑可以将用户手动添加到两个应用程序中。

Please see this relevant Github repository. 请参阅相关的Github存储库。 https://azure.microsoft.com/en-us/resources/samples/active-directory-b2c-javascript-angular2-4-spa/ https://azure.microsoft.com/en-us/resources/samples/active-directory-b2c-javascript-angular2-4-spa/

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

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