# Automatic migration only works if password is reset

**URL:** <https://community.auth0.com/t/automatic-migration-only-works-if-password-is-reset/58849>\
**Category:** Get Help\
**Tags:** postgresql, user-migration, database-connections\
**Created:** [March 3, 2021, 11:51pm UTC](https://community.auth0.com/t/automatic-migration-only-works-if-password-is-reset/58849 "2021-03-03T23:51:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mclslee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mclslee/32/27980_2.png) [@mclslee](https://community.auth0.com/u/mclslee)\
**Post date:** [March 3, 2021, 11:51pm UTC](https://community.auth0.com/t/automatic-migration-only-works-if-password-is-reset/58849/1 "2021-03-03T23:51:16Z")

</div>

Hi all, thanks for taking the time to read. Just a heads up, I might be posting more questions in the very near future as I’m trying to migrate our entire auth flow out of the application into auth0!

I’m trying to leverage custom database connections to automatically migrate our users into auth0. Setup was pretty easy, but it seems to not be entirely there.

Hitting `Try` for both my `Login` and `Get User` scripts under the custom database tab work perfectly; however, when I `Try Connection`, I’m getting a “Wrong email or password” every time. I found a couple of other related issue and one that did help was changing my `default directory` to the custom connection name, but it seems it’ still not completely working. The reason I say it helped is because if I go through the “Forgot password” flow for a known user in my database, the entire flow works: I get the email, I can go into the link and reset the password for that user. Then if I try logging in again inside `Try Connection` that user succeeds in logging in and is subsequently populated under the users option in my tenant.

Given it’s my first post, apologies if I’m breaking some sort of rule / not providing enough information. I’m fully heads down on this for a while though, so I will reply as soon as I see any additional request from me!

Thank you

---

<div class="post-metadata">

**Author:** ![john.gateley](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/john.gateley/32/10879_2.png) [@john.gateley](https://community.auth0.com/u/john.gateley)\
**Post date:** [March 4, 2021, 2:45pm UTC](https://community.auth0.com/t/automatic-migration-only-works-if-password-is-reset/58849/2 "2021-03-04T14:45:37Z")

</div>

Hi @mclslee

First thing to try is the “Real Time Webtask Logs” extension and console.log statements in your scripts:

> **[Real-time Webtask Logs Extension](https://auth0.com/docs/customize/extensions/real-time-webtask-logs)**
>
> Learn how to configure and use the Auth0 Real-time Webtask Logs extension.

This will give you some debugging info to figure out what is going on.

John

---

<div class="post-metadata">

**Author:** ![mclslee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mclslee/32/27980_2.png) [@mclslee](https://community.auth0.com/u/mclslee)\
**Post date:** [March 4, 2021, 3:33pm UTC](https://community.auth0.com/t/automatic-migration-only-works-if-password-is-reset/58849/3 "2021-03-04T15:33:47Z")

</div>

Hi @john.gateley, thanks for the resource, good tool to be aware of! I installed it and here are some screenshots for the script → output and behavior

Script:

 ![Selection_003](https://global.discourse-cdn.com/auth0/original/3X/8/2/821e817639e7ae2defb27141888fdddbb57d20ce.png) ![Selection_004](https://global.discourse-cdn.com/auth0/original/3X/1/0/10af22c777053c32376a98c44cf686e96f6b9f38.png) ![Selection_005](https://global.discourse-cdn.com/auth0/original/3X/9/3/93370896d41c25a5a93d388cf29c23515bba1215.png)

Behavior:

 ![Selection_002](https://global.discourse-cdn.com/auth0/original/3X/c/2/c2c931260d30c93c930fb3c9305a8096f454d92b.png)

Log:

 ![Selection_001](https://global.discourse-cdn.com/auth0/original/3X/5/d/5d1a0d581176ba5d6dbeca177a4382c78e902d60.png)

I did find in the documentation:

 ![Selection_006](https://global.discourse-cdn.com/auth0/original/3X/9/f/9faabe5918ad51d2b400a4681a901f70bcc0145a.png)

So I’m now wondering maybe it’s not allowed for me? I’m a free user right now but have 20 days remaining to “experiment with features that are not in the Free plan,” and I’m interpreting that as having access to this feature

---

<div class="post-metadata">

**Author:** ![john.gateley](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/john.gateley/32/10879_2.png) [@john.gateley](https://community.auth0.com/u/john.gateley)\
**Post date:** [March 5, 2021, 2:14pm UTC](https://community.auth0.com/t/automatic-migration-only-works-if-password-is-reset/58849/4 "2021-03-05T14:14:33Z")

</div>

So if I understand right, the scripts appear to be working: they validate the password is correct.

But the ULP is still displaying an error.

Correct?

Check your tenant logs, is there anything there?  
And open developer tools, see if there is anything there…

John

---

<div class="post-metadata">

**Author:** ![mclslee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mclslee/32/27980_2.png) [@mclslee](https://community.auth0.com/u/mclslee)\
**Post date:** [March 5, 2021, 3:40pm UTC](https://community.auth0.com/t/automatic-migration-only-works-if-password-is-reset/58849/5 "2021-03-05T15:40:58Z")

</div>

Hi again @john.gateley

The logs helped! I was returning the id: int primary key as user\_id, but we also have a unique character varying field that will suffice as that, so returning that instead makes it all happy. Though I’m not quite sure why after resetting a user’s password it worked, but I’m happy enough to move on haha.

Thank you!

PS. Would it be beneficial for others going forward to document that user\_id in the object passed in to the `callback` function cannot be an int?

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [March 8, 2021, 12:06pm UTC](https://community.auth0.com/t/automatic-migration-only-works-if-password-is-reset/58849/6 "2021-03-08T12:06:59Z")

</div>

Thanks for providing that feedback, I’ll make sure to relay it to our docs team!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 23, 2021, 12:07pm UTC](https://community.auth0.com/t/automatic-migration-only-works-if-password-is-reset/58849/7 "2021-03-23T12:07:57Z")

</div>

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