AuthGuard of Auth0 redirect is not working properly, Angular automatically redirects to base route



export const routes: Routes = [
    {
        path: 'home',
        canActivate: [AuthGuard],
        loadComponent: () => Home
    },
    {
        path: '',
        canActivate: [AuthGuard],
        loadComponent: () => LandingPage
    },
    {
        path: '**',
        redirectTo: 'home'
    }
];

I’ve been banging my head against the wall trying to figure out why my Angular app is automatically redirecting to root after momentarily visiting the correct redirectUri upon a successful login. I don’t use loginWithRedirect method in any component, I want to show the login form automatically without calling that method.

SDK: @auth0/auth0-angular (v^2.3.0)
Angular v20.2.0
Node v22.14.0

Hi @roman.savchuk

From what I can see in your Routes, the AuthGuard should not be the problem here. Usually, the AuthGuard redirect should first redirect to your application and the AuthService should be the one redirecting them to the page they initially intended to access.

Do any of your components redirect to any other routes or pages by any change or could it be triggered by something else? I would recommend inspecting your components and perhaps logging some information in the console to see exactly what triggers that redirect.

Kind Regards,
Nik