Auth0 Home Blog Docs

Migrating user data to passwordless connections

Right now, I’m considering how to migrate from existing legacy auth system to Auth0 passwordless connections in my customer project.

As first step, I will export all users data from the legacy DB( without password since it can’t export ), then import that into Auth0 with the Bulk User Import way. However, as far as I could tell from reading the Create job to import users API doc , it seems that you can’t directly import it to passwordless connections. would be good if you can specify the passwordless ID in connection_id param of the API. Any solution to solve it??

You are right that the docs say you’d need a database connection for the bulk import.

TBH I haven’t tested the bulk import myself yet with a Passwordless connection. Did you try it, what was the result you’ve gotten?

However, what definitely works is to use this endpoint
https://auth0.com/docs/api/management/v2#!/Users/post_users
and import the users one by one (you can build a simple script for it) to the “email” connection. I just tested it (via API Explorer) and it works.

Just make sure that prior to the import, you have the “email” passwordless connection enabled for the M2M client doing the import (in my example, since I used the API Explorer Application for testing, it was the client_id of the API Explorer App) in the Dashboard,

39%20PM

otherwise you would get an error like this:

{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "connection is disabled (client_id: {client_id_m2m_app_doing_the_import} - connection: email)",
  "errorCode": "auth0_idp_error"
}
1 Like

Thanks for the response @mathiasconradt

TBH I haven’t tested the bulk import myself yet with a Passwordless connection. Did you try it, what >was the result you’ve gotten?

I just tried but the API said Payload validation error: 'String does not match pattern ^con_[A-Za-z0-9]{16}$' on property connection_id.

However, what definitely works is to use this endpoint
https://auth0.com/docs/api/management/v2#!/Users/post_users
and import the users one by one (you can build a simple script for it) to the “email” connection. I just >tested it (via API Explorer ) and it works.

It works on my end too and will do the way.
Many thanks!

1 Like

Glad the other approach works for you.

Regarding the first error message with the bulk import. What did you use for the connection_id there? That is not email but should be the actual id you’re getting when you fetch all connections via the API explorer.

Go to the API Explorer, set the API token on there, then at https://auth0.com/docs/api/management/v2#!/Connections/get_connections fill out the strategy field with value email and click Try.

Then get the connection id from the id field of the response. Does that work?

Ah, I used email, and tried it again with the approach of your above comment but faced the following error. Seems like it’s not supported.

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