How to make MFA work with custom DB?

Hi,
How to make MFA work with custom DB? I want to have the user profile & meta data with custom DB and want to Enable/Disable MFA per user based on the data returned from custom db.

Note: My use case is to purely depend on Custom DB and don’t want to store any user related data in Auth0 DB.

Let me know if this is possible.

Thanks in advance !

Hi @thirumoorthy_n

Thank you for contacting Auth0 community !!!

You can implement post-login action Login Flow and trigger MFA based on the user metadata extracted off the Custom DB. Hope it helps.

Thanks
Jeff

1 Like

Thanks for helping on this one Jeff!

Hi Jeff,

Thanks for your reply! I have 2 questions here.

  1. Though we use custom DB to create user, why does it create user in Auth0 DB as well? I can see the user in users list. How to avoid creating user in Auth0 DB as I mentioned above I want to have user data only in custom DB which is our on-premise database.

  2. If we can achieve the above one, then how can I get user meta data from custom DB in “onExecutePostLogin” event object?

Thanks,

Hi @thirumoorthy_n

  1. Make sure silent migration is turned off. Import and Export Users
  2. Return profile with metadata as explained here: Login Script Templates

Thank you
Jeff

1 Like



Hi Jeff,

I did turn off Import Users to Auth0 and returning user meta data as mentioned. Please see the screenshots. Am I missing something?

Thanks,

Hi @thirumoorthy_n

When you use Custom DB connection to authenticate users Auth0 does create a shallow copy of the user in auth0 but it does not store passwords. Please read more here: Custom db source. Until you migrate users across, auth0 will continue to use your script to authenticate.

Hope it helps!!

Thank you
Jeff

1 Like

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