I have a users with email and password in my MS SQL. I want to migrate them over to Auth0. What is the best way to do this?
-
One way to do this is using Auth0 Management API v2 where I have to create JSON file with users. Looks like email is only required field here (I am not 100% sure)
-
Configure Automatic Migration from Your Database, Configure Automatic Migration from Your Database.
Question, can I connect my SQL database here and import all users in option 2?
Hi @Gunjan.Parmar ,
Welcome to the Auth0 Community!
Have you tried the Auth0 User Import/Export Extension? You can install this extension on the Auth0 dashboard, and use this extension to export the user details in JSON format from your MS SQL database and then import them in Auth0. This article explains the details.
Hope that helps!
1 Like
Hey,
Thank you for your quick response. I was getting An error occured while uploading the file: Bad Request
error. After disabling Use my own database
under Database Connections → YOUR-DATABASE, it shows successful. I can see them under users.
When I use below payload, it fails
[
{
"email": "bulkbuy@test.com",
"given_name": "Bulk",
"family_name": "Buy",
"name": "Bulk Buy",
"password_hash": "password_hash"
}
]
This one is successful
[
{
"email": "bulkbuy@test.com",
"password_hash": "password_hash"
}
]
I want to confirm, which is vallid model. I am looking at this, Bulk User Import Database Schema and Examples but not sure.
Thank you for the updates.
Ideally by selecting “User-Password-Authentication” which is Auth0, you should be able to upload the file without disabling your own database connection. Can you do a hard refresh of the browser and try again?
I just tested with the following with more than one user records and it works fine.
[
{“email":"test12@gmail.com”,
“given_name”:“test1”,
“family_name”:“test1FN”,
“name”:“test1 test1FN”
},
…
]
According to this article, password_hash can not be imported, so I did not include it in the import file.
1 Like
In my case, it is working with password_hash
. Per document This property can only be provided when the user is first imported and cannot be updated later.
which looks valid to me.
What I have noticed is, when I try to upload same user second time (just to see how Auth0 would behave), I am getting The user already exist and upsert parameter is false
error. Looks like I need to set this to true somewhere.
This, Bulk User Import Database Schema and Examples shows setting this flag. Not sure how to use this in User Import / Export
plug in.
2 Likes