Auth0 Beginner - What is the recommended best practice for synchronizing users with external databases?

I am developing an application using Vue.js (+Universal Login Auth0), Node.js, and a specific database. My goal is to integrate users created in Auth0 with my database, ensuring synchronization of information. In case of errors during user creation in Auth0 or in my own database, I want to execute a rollback to prevent data desynchronization between the two databases.

I would like to know if there are recommended best practices for this implementation or if there is a step-by-step guide that I can follow.

Hi @viniciusteixeiradias,

Welcome to the Auth0 Community!

There are different ways to approach synchronizing your external user DB with the Auth0 user store.

Alternatively, you can use your DB as the source of truth with Custom Database Connections, but this will limit you to only username/password connection and no third party IdPs like Google or Github.

Let me know if you have any questions.

Hi @dan.woda , thanks for your help, now the process is clearer.

I still have some questions but it’s about another subject, I’ll look in the community posts or maybe I’ll open a new discussion for that.

1 Like

Perfect. Hope that was helpful!

The login flow will only be executed when a user logs in. Other requests, such as fetching projects through an API, will not be affected, correct?

The post login action trigger is executed when a user authentication occurs. For example:

  • Interactive login
  • Refresh token exchange
  • Silent user authentication

Thank you for the reply , Now i am going to use postlogin action ,
So i want user orgnizationId for store into my db i have an one api to create user ,
But i need userId , email and organizationId .
I get userId and email using event but I don’t know how to get organizationId ?

If the event.organization object is undefined, it’s likely that the user has not logged in with an organization during this login transaction.

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