Share via

Angular , Ionic, "@azure/msal-angular" and "@azure/msal-browser" don't work together like in web without ionic

Mihajlovic, Milica 5 Reputation points
2023-12-03T14:51:13+00:00

I am using the "@azure/msal-angular" and "@azure/msal-browser" libraries for B2C login with Angular 15. I have already used them in a web application, and everything works fine. However, I am now building a mobile application with Ionic 7 and using the same code. I run the application with "ionic serve" to test it on the web. When I refresh the application, the method in the app component, this.msalBroadcastService.msalSubject$ (for EventType.LOGIN_SUCCESS), never gets called. The method is only triggered when the endpoint with a new scope is hit, resulting in EventType.SSO_SILENT_SUCCESS. The network tab does not show the endpoint being triggered to check if I am logged in when I refresh the application, as it does in the web version. My question is whether this is the expected behavior, or if something additional needs to be configured for Ionic. Also, do these libraries work with Ionic? If not, what alternative do you suggest? I prefer a free library that works with B2C, as I want to use the same login for both web and mobile applications.

Microsoft Security | Microsoft Graph
0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.