Skip to content

(Cancel button) Error - Guard - error while logging in, unable to activate #4378

Open
@Jacooscript

Description

@Jacooscript

Core Library

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

Core Library Version

2.21.0

Wrapper Library

MSAL Angular (@azure/msal-angular)

Wrapper Library Version

2.1.0

Description

I am integrating B2C the same way as it's described in https://github.com/Azure-Samples/ms-identity-javascript-angular-tutorial/tree/main/3-Authorization-II/2-call-api-b2c in my project

My app has "/panel/settings" Component, which is protected by MsalGuard:

const panelRoutes = [
  { path: '', component: PanelHomeComponent },
  { path: 'settings', component: PanelSettingsComponent },
];

const routes: Routes = [
  { path: 'panel', component: PanelComponent, canActivate: [MsalGuard], children: panelRoutes },
];

I implemented EditProfile button (redirect) there. It works ok when I update the profile (it redirects me to "/panel/settings" without any issues). But there is a problem when I click a Cancel button (default EditProfile user flow).
Logs:
image

Steps and redirects:

  1. I click the Cancel button on the default EditProfile B2C page
  2. Auto-redirect to https://localhost:4200/
  3. Auto-redirect to https://localhost:4200/panel/settings
  4. Auto-redirect to https://localhost:4200/ (wrong)

When I try to click Login button again on the landing page after all auto-redirects:
image

Angular: 13.0.2
.NET Core: 6

MSAL Configuration is the same as in https://github.com/Azure-Samples/ms-identity-javascript-angular-tutorial/tree/main/3-Authorization-II/2-call-api-b2c (different clientId, etc params ofc)

MSAL Configuration

No response

Relevant Code Snippets

No response

Identity Provider

Azure B2C Basic Policy

Source

Internal (Microsoft)

Metadata

Metadata

Assignees

No one assigned

    Labels

    b2cRelated to Azure B2C library-specific issuesbugA problem that needs to be fixed for the feature to function as intended.msal-angularRelated to @azure/msal-angular packagemsal-browserRelated to msal-browser packagetracked-internallyBugs that are tracked by Msft internally

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions