# Import from another product

> The rules every importer follows: kept IDs, no matching by address, and a stop at any field it doesn't know.

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/import.

The importer reads the files that the other product gives you. It
never connects to the product.

```sh
tensile-auth-server import --from auth0 password-hashes.jsonl --users users.json
tensile-auth-server import --from clerk users.csv
tensile-auth-server import --from supabase supabase-users.csv
```

Before you import, set `passwords.accept_bcrypt` to `true`. All three
products store bcrypt hashes. The library verifies a bcrypt hash with a
cost from 10 to 14 and replaces it with Argon2id at the person's first
sign-in. `tensile-auth-server check` reports how many bcrypt hashes
remain.

| Flag | What it does |
|---|---|
| `--users FILE` | For Auth0 only: the bulk user export |
| `--mint-ids FILE` | Gives each user a new `usr_` ID instead of the product's, and writes `source_id,user_id` rows to `FILE`, a new file with mode `0600`, before it stores the users |
| `--dry-run` | Reads and checks the files, prints what it would import, and stores nothing. It writes no mapping |
| `--merge` | Imports into an install that has sign-in records. A user whose address or identity exists is skipped and reported |

Every source follows these rules:

- **The product's user ID is kept**, for example `auth0|64f0…`, so your
  application's rows keep pointing at it. Pass `--mint-ids` for new IDs.
- **Nothing is matched by address.** Two users with the same normalized
  address are both skipped and reported, and so are two users with the
  same Google or GitHub account.
- **Blocked, banned, and deleted users are skipped and reported.**
- **An unknown column or field stops the import.** The importer doesn't
  guess what an unknown value holds. If a product adds a column, remove
  it from the file, or ask for the importer to read it.
- **From Auth0 and Supabase, Google and GitHub identities come across.**
  Other providers' identities are left out and counted. Clerk's export
  has no identities, so none come across from Clerk.
- **A person without a bcrypt hash comes across without a password.**
  They reset it by email. From Auth0 or Supabase, they can also sign in
  with Google or GitHub.
- **No product exports passkeys or TOTP secrets that the importer
  reads.** Those people enroll again.

The command prints what it read, what it stored, and each user it
skipped, with the reason: `blocked`, `deleted`, `shared_address`,
`shared_identity`, `invalid_address`, `nothing_to_sign_in_with`, or
`exports_disagree`.
