Automatic User Migration with Custom Database not working (SOLVED)

I’m testing Automatic User Migration with custom database, I have modified Login/GetUser script under my custom database connection and tested them out. They worked and I got the correct data back from my own database. I’ve also clicked “Try Connection” and entered email and password, and they are working as well, an user from my own db is added to the Auth0 db with correct email. But when I tried to login through my angular application with Auth0 lock screen, I can’t login with the same email and password I used during my test. I always got “Wrong Email or Password” error massage. It doesn’t seem to use the Login script under my custom db connection.

Anyone can shed some light one this? Thanks in advance.

Here is my settings for my application and my connection:

Dear Customer Support, Could you please address this issue?

It appears you need to connect only the custom database (and not the default one) to your client (contrary to what the description say).
In your case, you should turn off “Username-Password-Authentication” DB in your client.
I also had to go back to “settings” and hit the save on the client again…

1 Like

Thank you ittayo. Yes, after turning off the “Username-Password-Authentication” connection under my application, it is working now. It connects to our custom db now. I guess they should modify the Automatic User Migration Guide document.
Should we turn off our custom db connection and turn on Auth0 default DB connection after all users migrated to Auth0?

Turning off “Username-Password-Authentication” connection seem to cause another problem. I use to use Postman to test our API calls. The first step would be calling Auth0 oauth/token to get the access Token to ur API. After turning off the “Username-Password-Authentication” connection, get Auth0 Token call is broken. Now I’m getting the following error message when calling [OurDomainAtAuth0]/oauth/token endpoint:
{
“error”: “invalid_request”,
“error_description”: “connection is disabled (client_id: XXXXXX - connection: Username-Password-Authentication)”
}

1 Like

Figured out the problem. I had to change the Default Directory under tenant setting to my custom DB connection. Now everything is working.

1 Like

I’m glad to hear it all came together @ittayo and @sally! Is there anything documentation wise that you feel we can do to improve this process? Thanks in advance!

Hi James, Yes please update your documentation:

  1. only the custom db connection should be configured for the application. turn off the default auth0 "Username-Password-Authentication” connection

  2. make sure the “Default Directory” under tenant setting is set to the custom db connection. This is needed when trying to do authentication using Password Grant exchanges, such as using Postman calling Auth0 Get Token API endpoint (https://{{auth0_domain}}/oauth/token)

  3. Please be more clear as what you mean by “disconnect your legacy database” in the last paragraph of the " Automatic User Migration with Custom Database Connection" document:

At this point, you can disconnect your legacy database ( not the Auth0 database). You will also want to keep Import Users to Auth0 (on the Settings page) enabled. Your users will then be directed to use the new database workflow.

Do we need to turn off the custom db connection under the application and turn on the “Username-Password-Authentication” connection? Or should we just leave everything(connections) as is, just remove our own Login/getUser script?

Thanks!

1 Like

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

Do we need to turn off the custom db connection under the application and turn on the “Username-Password-Authentication” connection?

No

Or should we just leave everything(connections) as is, just remove our own Login/getUser script?

Yes, you leave everything as is, but put in the login/getUser script as per docs. That’s all you need to do.

“Disconnecting your legacy database” basically means that after you’ve changed the login/getUser script, Auth0 won’t call your physical legacy DB anymore and you’re free to shut that DB server down, close the firewall on your end, etc.