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
Since I haven’t heard from you for a while @roman.savchuk , I will be marking the above reply as the solution to the thread.
If you will still need assistance on this matter, please send me a DM to reopen to the topic if it gets closed or just reference this one in your new one!
Kind Regards,
Nik