Auth0 Home Blog Docs

User data split between Auth0 native store and custom DB - link & sync



Suppose I have an existing user store for my application, but want to migrate to a native Auth0 user store, e.g. by setting up a custom database connector with incremental migration.

However, there is likely to be data about a user that I’ll want to continue to manage in my application user store, even if the native Auth0 store becomes the “master” for some attributes (e.g. password). I may also want to continue to offer application-specific User Management screens in my app, even if these screens are modified in the backend to use Auth0 APIs to effect changes, do queries etc.

In this scenario there would be a requirement to maintain a sync relationship between my apps’s user data and Auth0’s native user store. For example, I’d want to record in my app user record the corresponding Auth0 user_id, and I’d like to store my app user id as a piece of app metadata against the corresponding Auth0 user record.

If I mandated that user management was always performed in my applicaton I think I could see how to do this (e.g. when creating a user, send the local app id as a piece of metadata to the Auth0 CreateUser API, then store the returned Auth0 user_id against my user record.

However there are two scenarios where ongoing sync would appear to be more challenging:

  1. If someone uses the Auth0 dashboard to make changes to users.

  2. As part of “incremental migration”, when “legacy” standalone app user records get migrated over to Auth0 as a side-effect of user authentication.

In those cases I could see that I’d need Auth0 “hooks” to be able to trap these events/changes and then call out to my app using e.g. nodejs scripts to make the corresponding changes to my app DB.

Is there any provision in Auth0 for writing such hooks to allow user data sync?