I’m using Auth0 Lock for logins/registrations and I’ve implemented a Pre User Registration custom Action to perform additional verification on users before allowing access. Everything is working fine, and I’m passing a “reason” and a “message” to the call to api.access.deny(), which can be different depending on which problems are detected in the Action. I can see the “reasons” displayed in the Auth0 monitoring log.
I would like to take different actions on our end, such as redirecting to specific pages, depending on the “reason” a user has been denied access. However, I haven’t found a way to access the “reason” after the access denial occurs.
I’ve tried listening for lock->authorization_error and lock->unrecoverable_error but neither appear to be triggered. So far, the only way that I’ve found to even know that the access denial has occurred is because the lock.fallback error is displayed. So I could modify the error message to handle this case, but obviously this is far from ideal.
So, how can I find out the “reason” a user has been denied access from a Pre User Registration custom Action?