I’m trying to migrate from an existing system that implements passportjs that connects to multiple providers, and stores users by their connection + oauth id in a relational database.
I noticed that the Auth0 database type seems to only support username/password type logins, which our system does not have since a user would auth through a 3rd party like Github and the system would use the Github id as the basis for their user entry in its database.
Likewise with the User Import/Export extension. It’s interesting that I can export by oauth connection, but I’m unable to import to an oauth connection (it seems only Auth0 password databases are supported).
Is there a way to import users by connection type, and maintain that association? For example, I import the github users that were in the system into Auth0, and users that perform OAuth using Auth0 via the github connector would already be linked to their existing data.
I guess one solution could be (we use passportjs):
- When a user logs in via Auth0 through Github
- In the passportjs strategy verify callback where you are given the user information from Auth0, check our internal database for the oauthid
- If the oauth id exists and the user has not been migrated (Maybe set some kind of user metadata flag?), then migrate info from the database using the user management API
- Update the Auth0 user metadata to note that they have been migrated
The problem with this approach is that it requires a user to interact, as opposed to being able to run a one-time script that can import each user in the system’s database without user interaction.
Wondering how people have handled this.