How to get login error information in the redirect destination page, at login callback?

that’s a very simle issue.
currently, my app (SPA, Angular 12) has only 3pages. root, logincallback and error.

redirectUri: http://localhost:4200/logincallback
errorPath: /error

in this case, if a blocked user try to log in my app, Auth0 will callback with error like below

http://localhost:4200/logincallback?error=unauthorized&error_description=user%20is%20blocked&state=xxxxxx

but auth0 library redirects to /error without query parameter automatically and quickly (by errorPath configuration), so I can not get error reason like “unauthorized, user is blocked” and so on.

please tell me how to get error at the automatic redirect destination.

plartform: Angular 12
SDK: auth0/auth0-angular 1.17.0

I figured out the solution from the official sample as below by myself.

// get error object from library, at the component that is set in errorPath option.
public error$: Observable<any> = this.auth.error$;

and we need to add more small code to html.
we can see useful code at above link.

thank you so much!

1 Like

Thanks for sharing that with the rest of community @Yas !