Microsoft-authentication-library-for-js: When will msal-angular move to MSAL 2.0?

Created on 29 May 2020  路  7Comments  路  Source: AzureAD/microsoft-authentication-library-for-js

Library

Description

ETA needed.

I am building a First party Microsoft app and need to move to Auth code flow. Should I use the MSAL browser instead?

I am currently using MSAL Angular 1.x.x

@hamiltonha

THanks

msal-angular question

Most helpful comment

Got it working.

I have the same problem and I am trying to get it to work as well. Do you have an example of how you got it to work? Thanks in advance.

All 7 comments

@jrmcdona This work is not yet scheduled. We are first waiting for MSAL.js v2 to be stable, and then it is a matter of scheduling it in relation to other priorities of our team. We'll post an update when we know more.

In the mean time, if you need to move to the Auth Code Flow, I would recommend using MSAL.js v2 directly.

Ok, thanks working on it as we speak.

Got it working.

Got it working.

I have the same problem and I am trying to get it to work as well. Do you have an example of how you got it to work? Thanks in advance.

@jrmcdona I'd also be super keen to see how you got it working, as I'm hitting the same issue

@ollief87 what is the issue you have?

I have this in my app.component.ts

const msalConfig: msal.Configuration = {
        auth: {
          clientId: environment.msaClientId,
          authority: environment.msaIssuer,
          redirectUri: environment.oAuthRedirectUrl,
        },
        cache: {
          cacheLocation: "localStorage", // This configures where your cache will be stored
          storeAuthStateInCookie: false, // Set this to "true" if you are having issues on IE11 or Edge
        }
      };

      this.msalInstance = new msal.PublicClientApplication(msalConfig);

      this.msalService.setMsalInstance(this.msalInstance);

      // Register Callbacks for Redirect flow
      this.msalInstance
      .handleRedirectPromise()
      .then((tokenResponse) => {

        this.msalCallBackFired = true;

        if (tokenResponse !== null) {
            // Account object was retrieved, continue with app progress
            console.log("id_token acquired at: " + new Date().toString());
            // showWelcomeMessage(accountObj);
            localStorage.setItem("current", tokenResponse.account.username);
            this.userService.setIsAuthenticated(true);
            this.getUserSettings();

          } else {
            // need to call getAccount here?
            const currentAccounts = this.msalInstance.getAllAccounts()
            if (currentAccounts === null || currentAccounts.length < 1) {
              this.userService.setIsAuthenticated(false);
              this.getUserSettings();
            } else {
              this.userService.setIsAuthenticated(true);
              this.getUserSettings();
            }
          }
        })
        .catch((error) => {
          console.log(error);
        });

I have a MSAL Helper service which has all the main functions like LoginRedirect and SilentRequest.

Was this page helpful?
0 / 5 - 0 ratings