This is a one-off ETL script for migrating user credentials from the Permanent.org application database to Auth0, an authentication vendor.
It connects directly to the Permanent MySQL database, and knows the relevant parts of the database schema at the time it was written.
After extracting the data, it performs two transformations.
First, it replaces the PHP-specific $2y$
bcrypt hash type prefix with
the standard $2a$
, as Auth0 does not recognize that prefix; see also this
history of BCrypt variants.
Second, it formats the data into
Auth0's user import schema.
Finally, it loads the data into Auth0 using their bulk user import API. (If our production data turns out to be larger than the 500KB limit, then this will also handle splitting it into smaller chunks and submitting multiple import jobs.)
Copy .env.template
to .env
, set the values, and run npm run start
.