API responding to a rule

I’ve been following this guide: https://auth0.com/docs/rules/current/redirect to use rules so that I can register a user’s user_Id as a foreign key to related records. In my rule, I’m checking to ensure the protocol is not a redirect callback and that this is the user’s first time logging in (registering). That worked great, however I’m not exactly sure how to handle any errors down the Rule pipeline.

For example when creating a user, I check the database connection and if it’s unavailable then an error is thrown, if the new user record cannot be made, then another error is thrown, or what if the user.user_id or state from the Rule somehow doesn’t get passed as query arguments to my API?

Currently I’ve been catching those errors, and if found then I redirect the user to a custom “Unauthorized” url. This seems a little bit hacky, and I’m wondering if there is any functionality in Auth0 that handles these errors more elegantly, such as on an error, redirecting to some particular Auth0 route (maybe even Lock again).

FYI, using React front-end and Go for the API.

Any help is appreciated!

Hey there @gregp,

As it has been more than a few months since this topic was opened and there has been no reply or further information provided from the community as to the existence of the issue we would like to check if you are still facing the described challenge?

We are more than happy to assist in any way! If the issue is still out there please let us know so we can create a new thread for better visibility, otherwise we’ll close this one in week’s time.

Thank you!

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.