Prevent Angular AuthGuard from redirecting to login form

I followed the basic Angular tutorials for integrating Auth0 and I have run into a snag. I do not want the behavior outlined below:

Protect a route component using the built-in AuthGuard . Visits to this route when unauthenticated will redirect the user to the login page and back to this page after login.
Link To Post

I want the AuthGuard to redirect to a general login page in my application, instead of the Auth0 login form. Is there any way to configure this behavior? I have not found any documentation regarding it.

Thanks!

3 Likes

Hi @cody.wilson,

I have the same issue with an application that I am migrating from auth0-js where we also have a general login page where additional information is displayed like helpdesk number and an API status message.

Did you manage to solve this issue?

Thanks

(Angular SDK)

Yup having the same issue, pages protected by a canActivate: [AuthGuard] will redirect users to the login page if they try to access it logged out. Is there a way to not redirect the user?

In the AuthGuard ts file on the SDK, I see a private property called. ‘redirectIfUnauthenticated’, is there a way to set this to false?

1 Like

Literally just ran into this issue as well. Is there a way to have a custom URL to turn off this behaviour?