Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firefox stuck in login loop #5118

Closed
eluchsinger opened this issue Aug 19, 2022 · 14 comments
Closed

Firefox stuck in login loop #5118

eluchsinger opened this issue Aug 19, 2022 · 14 comments
Assignees
Labels
answered Question has received "first qualified response" b2c Related to Azure B2C library-specific issues bug-unconfirmed A reported bug that needs to be investigated and confirmed msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.

Comments

@eluchsinger
Copy link

Core Library

MSAL.js v2 (@azure/msal-browser)

Core Library Version

2.28.1

Wrapper Library

MSAL Angular (@azure/msal-angular)

Wrapper Library Version

2.4.1

Public or Confidential Client?

Public

Description

On Firefox we are noticing a redirection loop when trying to login. This stops from happening after clearing the cookies & cache.

Error Message

The only errors I get is an HTTP 400 from AAD B2C and the error below from MSAL:

{
    "error":"invalid_grant",
    "error_description":"AADB2C90128: The account associated with this grant no longer exists. Please reauthenticate and try again.\r\nCorrelation ID: <redacted>\r\nTimestamp: 2022-08-19 08:11:57Z\r\n"}

@azure/msal-angular@2.4.1 : Error - Interceptor - acquireTokenSilent rejected with error. Invoking interaction to resolve.

Msal Logs

Sorry. Can't do, because I can not reproduce the behavior after clearing the cookies once.

MSAL Configuration

{
    auth: {
      clientId: environment.AzureClientId,
      authority: b2cPolicies.authorities.signUpSignIn.authority,
      redirectUri: "/",
      postLogoutRedirectUri: "/",
      knownAuthorities: [`${environment.AzureB2CName}.b2clogin.com`],
    },
    cache: {
      cacheLocation: BrowserCacheLocation.LocalStorage,
      storeAuthStateInCookie: isIE,
    },
    system: {
      loggerOptions: {
        loggerCallback,
        logLevel: LogLevel.Warning,
        piiLoggingEnabled: false,
      },
    },
  }

Relevant Code Snippets

None

Reproduction Steps

  1. Navigate to a guarded route via MsalGuard using Firefox
  2. Get stuck in a loop

Expected Behavior

Go to the login screen or serve the guarded route if already logged in.

Identity Provider

Azure B2C Basic Policy

Browsers Affected (Select all that apply)

Firefox

Regression

No response

Source

External (Customer)

@eluchsinger eluchsinger added bug-unconfirmed A reported bug that needs to be investigated and confirmed question Customer is asking for a clarification, use case or information. labels Aug 19, 2022
@ghost ghost added the Needs: Attention 👋 Awaiting response from the MSAL.js team label Aug 19, 2022
@github-actions github-actions bot added b2c Related to Azure B2C library-specific issues msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications labels Aug 19, 2022
@ghost ghost assigned hectormmg Aug 19, 2022
@eluchsinger
Copy link
Author

I have to say these loops have been a common thing for MSAL since it's release. Maybe you could look into implementing better tools to detect them (and gather the metrics needed to understand them) and if possible automatically try to fix them, like trying to clear the storages.

@hectormmg
Copy link
Member

@eluchsinger thanks for the suggestion and for opening the issue. Was this loop something that was only seen once and fixed by clearing storage and cookies? Or has it been noticed by multiple users?

@ghost ghost added answered Question has received "first qualified response" Needs: Author Feedback Awaiting response from issue author and removed Needs: Attention 👋 Awaiting response from the MSAL.js team labels Aug 22, 2022
@ghost
Copy link

ghost commented Aug 28, 2022

@eluchsinger This issue has been automatically marked as stale because it is marked as requiring author feedback but has not had any activity for 5 days. If your issue has been resolved please let us know by closing the issue. If your issue has not been resolved please leave a comment to keep this open. It will be closed automatically in 7 days if it remains stale.

@ghost ghost added the no-issue-activity Issue author has not responded in 5 days label Aug 28, 2022
@eluchsinger
Copy link
Author

@hectormmg it was experienced by multiple users. All on Firefox and probably had not used the login in a while (could both be coincidence of course).

@ghost ghost added Needs: Attention 👋 Awaiting response from the MSAL.js team and removed Needs: Author Feedback Awaiting response from issue author no-issue-activity Issue author has not responded in 5 days labels Aug 28, 2022
@hectormmg
Copy link
Member

@eluchsinger could you show us what you're passing in your app-routing.module.ts so we can see how your app implements reidrects?

@ghost ghost added Needs: Author Feedback Awaiting response from issue author and removed Needs: Attention 👋 Awaiting response from the MSAL.js team labels Aug 29, 2022
@eluchsinger
Copy link
Author

@hectormmg of course.

This is what we are doing in the app-routing:

import { NgModule } from "@angular/core";
import { Routes, RouterModule } from "@angular/router";
import { IndexComponent } from "./index/index.component";
import { MsalGuard } from "@azure/msal-angular";
import { BrowserUtils } from "@azure/msal-browser";

const routes: Routes = [
  {
    path: "",
    component: IndexComponent,
  },
  {
    path: "b2b",
    loadChildren: () => import("./b2b/b2b.module").then((m) => m.B2bModule),
    canActivate: [MsalGuard],
  },
];

@NgModule({
  imports: [
    RouterModule.forRoot(routes, {
      initialNavigation:
        !BrowserUtils.isInIframe() && !BrowserUtils.isInPopup()
          ? "enabledNonBlocking"
          : "disabled", // Set to enabledBlocking to use Angular Universal
    }),
  ],
  exports: [RouterModule],
})
export class AppRoutingModule {}

@ghost ghost added Needs: Attention 👋 Awaiting response from the MSAL.js team and removed Needs: Author Feedback Awaiting response from issue author labels Aug 31, 2022
@ghost
Copy link

ghost commented Sep 5, 2022

This issue requires attention from the MSAL.js team and has not seen activity in 5 days. @hectormmg please follow up.

4 similar comments
@ghost
Copy link

ghost commented Sep 11, 2022

This issue requires attention from the MSAL.js team and has not seen activity in 5 days. @hectormmg please follow up.

@ghost
Copy link

ghost commented Sep 16, 2022

This issue requires attention from the MSAL.js team and has not seen activity in 5 days. @hectormmg please follow up.

@ghost
Copy link

ghost commented Sep 21, 2022

This issue requires attention from the MSAL.js team and has not seen activity in 5 days. @hectormmg please follow up.

@ghost
Copy link

ghost commented Sep 26, 2022

This issue requires attention from the MSAL.js team and has not seen activity in 5 days. @hectormmg please follow up.

@ghost
Copy link

ghost commented Oct 2, 2022

This issue requires attention from the MSAL.js team and has not seen activity in 5 days. @hectormmg please follow up.

@hectormmg hectormmg assigned jo-arroyo and unassigned hectormmg Oct 4, 2022
@jo-arroyo
Copy link
Collaborator

jo-arroyo commented Oct 5, 2022

@eluchsinger Picking up this issue. Have you continued to see this behavior since the last comment? If so, are you able to get verbose logs and a network trace? We have thus far been unable to reproduce this behavior on our end.

@ghost ghost added Needs: Author Feedback Awaiting response from issue author and removed Needs: Attention 👋 Awaiting response from the MSAL.js team labels Oct 5, 2022
@eluchsinger
Copy link
Author

@jo-arroyo I haven't heard of any further problems. I think we can close this issue. Thanks!

@ghost ghost added Needs: Attention 👋 Awaiting response from the MSAL.js team and removed Needs: Author Feedback Awaiting response from issue author Needs: Attention 👋 Awaiting response from the MSAL.js team labels Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered Question has received "first qualified response" b2c Related to Azure B2C library-specific issues bug-unconfirmed A reported bug that needs to be investigated and confirmed msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.
Projects
None yet
Development

No branches or pull requests

3 participants