How can I add a user to my backend database after they register

I have a react app using auth0-react to authenticate my users everything is working fine on that end.
However, I have a backend node/express application and Postgres DB that I need users to also save to after registering.

I want to be clear that I do not want to replace auth0’s DB I just want to save a user to my DB in parallel.

I tried using auth0’s hooks but I can not connect to my local DB in development, not sure what else I can do.

Welcome to the Auth0 Community, @mcodes !

As you’ve already mentioned, the feature that looks like would fit best to your use case would be a Post-User Registration hook. Have you tried troubleshooting the connection for example via our Real-time Webtask Logs extension? What errors or problems are you facing?

Depending on your use case, you could potentially leverage a Create Script Action Script, but this is an Enterprise plan feature only as documented here: Pricing - Auth0

1 Like


Thanks for the reply. So the way I tried was in the Post-User Registration and Pre-User Registration. My idea was to make a call to my backend with the user in the payload and then save them that way after they register. But I can’t send any calls to my local backend server is that even possible I would assume It would have to have an endpoint on the open internet for this to work.

1 Like

@mcodes your last assumption is correct. You would need to expose your development database (IP and port) so it can be connected through the Internet by Auth0. Exposing your database should be possible and will depend on your Operating System settings, local network configuration, and database settings. You might find some of the required information on PostgreSQL: Documentation

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