question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When will msal-angular move to MSAL 2.0?

See original GitHub issue

Library

  • @azure/msal-angular@1.x.x

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
f430FERRARIcommented, Jun 15, 2020

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.

0reactions
jrmcdonacommented, Aug 18, 2020

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MSAL for Angular v2 is now available
We're excited to announce the release of a new Microsoft Authentication Library (MSAL) for Angular. We're calling it MSAL Angular v2.
Read more >
Upgrading from Azure MSAL to MSAL 2.0 - Stack Overflow
There is a to migrate the URIs there from Web to Single-Page Application... Looks like this change to the App registration is required...
Read more >
azure/msal-angular - npm
The latest @azure/msal-angular package does NOT support the implicit flow. Guides. Upgrade Guide (v1-v2) · Upgrade Guide (v0-v1) · Configuration ...
Read more >
Deep dive on using MSAL.js to integrate Angular single-page ...
Your browser can 't play this video. Learn more. Switch camera.
Read more >
Microsoft Authentication Library for JavaScript (MSAL.js)
Once our core 1.x+ is stabilized, we are going to bring our msal-angular library ... Msal implments the Implicit Grant Flow, as defined...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found