microsoft-authentication-library-for-js: loginRedirect() does not work

Library

  • @azure/msal-angular@1.2.2-beta.1

Framework

angular v8

Description

loginRedirect() does not return to msal: loginSuccess() and the user does not get logged in.

Expected behavior

It should logs in the user.

Browsers

It does not work in all the browser.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 23 (5 by maintainers)

Most upvoted comments

@jasonnutter When will be the next version available?

We made some fixes to handleRedirectCallback that will be available in the next version of MSAL, which I think may fix these issues.

One things I did notice is that this part of the sample:

    this.authService.handleRedirectCallback((authError, response) => {
      if (authError) {
        console.error('Redirect Error: ', authError.errorMessage);
        return;
      }

      console.log('Redirect Success: ', response.accessToken);
    });

Should be:

    this.authService.handleRedirectCallback((authError, response) => {
      if (authError) {
        console.error('Redirect Error: ', authError.errorMessage);
        return;
      }

      // Response could be an ID token (after loginRedirect operations)
      // or an access token (after acquireTokenRedirect operations)
      console.log('Redirect Success: ', response);
    });

I’ll get that fixed in the samples.

@jasonnutter

This is my configuration:

MsalModule.forRoot({ auth: { clientId: '<client-id>', validateAuthority: false, redirectUri: 'https://localhost:44316/', postLogoutRedirectUri: 'https://localhost:44316/', navigateToLoginRequestUrl: true, }, cache: { cacheLocation: 'localStorage', storeAuthStateInCookie: isIE, // set to true for IE 11 }, system: { tokenRenewalOffsetSeconds: 120, } }, { popUp: false; unprotectedResources: ['https://www.microsoft.com/en-us/'], extraQueryParameters: {} }) This is my handleRedirectCallback()

this.authService.handleRedirectCallback((authError, response) => { if (authError) { console.error('Redirect Error: ', authError.errorMessage); return; } console.log('Redirect Success: ', response.accessToken); });

My issue is that when I call loginRedirect() function, it redirects me to the sign in page of the tenant. But after I fill my details and click on Sign in it does not get redirected to the msal: loginSuccess() broadcast service.

It does not show any error in the console as well.