Angular Auth0 SDK re-routes to homepage after login denied from action

Hey all,

I have an Angular app and I’m running a post-login action that denies login (api.access.deny('email_unverified');) if the user has not verified their email yet.

I use the following statement to log in:

        appState: {
          returnTo: '/callback',
          target: '/callback2'

When login is successful, all is well. However, if access is denied, I’m briefly redirected to /callback with the error description in the query params, and then immediately redirected home (‘/’).

According to the Angular router logs, routing to the callback URL is never finalized before re-routing home so I’m unable to retrieve the error message in the query param.

So I guess my questions are:

  • Why does this redirect home instead of to a URL that I set specifically in the event of an error?
  • Is there an optimal way of retrieving this error message?