One Application with two custom database connections

Hey,

I currently have a problem with one Application but with two (custom) database connections.

So, suppose I have one application

  1. Application A

with custom database connections like

  1. Database 1 - custom Connection leads to Foreign API 1
  2. Database 2 - custom Connection leads to Foreign API 2

What I want to approach is, that a user which exists in DB1 and/or DB2 can login.
What’s working, when the user isn’t migrated to Auth0 yet and logs in with his credentials valid for DB1.
But in the case the user isn’t migrated to Auth0 yet and the user trys to login with his credentials (same email address, but different password) not valid for DB1, but only for DB2 it isn’t working and an error appears.

Also in this context, would it be possible to login the user, when the user is already migrated (with his credentials from DB1), but trys to login with the credentials valid in DB2?
With Account Linking Extension in the works…

Thanks for your help in advance.

Hi @hendrik.kuehnel ,

Auth0 will default to just one user/password database connection, so in your case its current default is Database 1. To connect with Database 2 the connection parameter needs to be specified in the /authorize call, hence why its falling here when a user that belongs to DB 2 attempts to sign in.
So your applications may need to handle how it points the user to the right connection to use. Alternatively I think it possible to write some logic when using Auth0 Lock that could determine which database to use, see further information here - Select from Multiple Connection Options.
Thanks!

1 Like