# Import from Auth0

> Bring Auth0 users across from the password hash export and the bulk user export.

From `docs/export.md` in tensile-tools/tensile-auth at commit `e66760d` (v0.4.1-7-ge66760d). The HTML page is https://auth.tensile.tools/docs/migrate/auth0.

Auth0 gives you two files:

1. **The password hash export.** Ask Auth0's support for it. It is a
   JSON Lines file with one line for each database user, with the
   fields `_id`, `email`, `email_verified`, `passwordHash`,
   `password_set_date`, `tenant`, `connection`, and `_tmp_is_unique`.
2. **The bulk user export**, optional. Start a users-exports job with
   the Management API, in the `json` format, with exactly these fields:

   ```json
   {
     "format": "json",
     "fields": [
       {"name": "user_id"},
       {"name": "email"},
       {"name": "email_verified"},
       {"name": "blocked"},
       {"name": "created_at"},
       {"name": "identities"}
     ]
   }
   ```

   Download the file the job links to. The importer reads it gzipped or
   not.

Without the bulk export, the importer imports the database users of the
hash export, and can't see who is blocked. Without the hash export, it
imports addresses and identities, and people reset their passwords by
email.

A database user's ID is `auth0|` followed by the hash export's
`_id.$oid`. An identity with the provider `google-oauth2` becomes a
Google identity, and `github` a GitHub identity. A user whose two
exports give different addresses is skipped as `exports_disagree`.
