Microsoft-authentication-library-for-js: Support for Ionic

Created on 31 Mar 2020  路  9Comments  路  Source: AzureAD/microsoft-authentication-library-for-js

Library

Description

Hello,
Is there any possibility to make MSAL compatible with ionic 4/5 (cordova/capacitor) ?
Thank you

feature question

All 9 comments

Right now we're prioritizing getting our 2.0, Angular, and Node libraries out into the wild, but after that we'll be looking at more granular library use cases, similar to our Angular and Node libraries. We will keep something like this on our radar, but it's not currently on the roadmap.

You may already know this and may not apply to your use case--but there is also an msal for iOS and for Android.

In case this is of interest, I tried to use msal-angular in an Ionic 5 project and initially it seemed to work, there were no error messages and when a route was executed with the MsalGuard route guard it correctly redirected to the Azure B2C login page and afterwards back to the Ionic application, thus completely as expected. Unfortunately after the redirect msalAuthService.getAccount() returns null and localStorage seems to be empty.

My theory is, though I don't have enough inside into the msal and Ionic codebase to be sure, is that Ionic uses a different routing system whereas msal-angular assumes the default Angular routing module, thus the necessary processing for the B2C login result which is probably hooked into the Routing module is never actually executed.

Let's assume for now that this is the only thing that is missing for Ionic compatibility (and it very well might be), could it be a rather simple fix somewhere? @jmckennon Could you maybe point me in the right direction?

@nmehlei can you please provide a git rep so I can test it, I will try to figure out a solution , I really need this auth , we have a new project in progress and the deadline is coming soon , and I'm not able to do the Auth right now ... :/

@webteambel Unfortunately no, I moved on from Ionic as we just had too many issues with it. Though if I remember I just followed exactly the same guides as for angular.

@webteambel I'm having some success using this plugin https://github.com/wi3land/ionic-appauth-ng-demo

@jchri853 unfortunately I was not able to sign in using the plugin

it would be great if we have Msal for ionic 馃憤

@jchri853 unfortunately I was not able to sign in using the plugin

What issues are you seeing?

Now that MSAL 2 has shipped this should be re-opened - currently there is no viable way to use MSAL with Ionic apps that are intended for both browser and native, and I imagine this is the same of other hybrid frameworks

Was this page helpful?
0 / 5 - 0 ratings