<@U04UQ68083H> if I want to import users from anot...
# ory-copilot
s
@chilly-king-10285 if I want to import users from another provider and I have access to their argon2 hashed passwords, then what would the curl command look like and what does the kratos configuration yaml need to look like for it to work?
b
A message from kapa.ai
If you have access to Argon2-hashed passwords from another provider, you can import users into Ory Kratos by providing the Argon2 hash in the
hashed_password
field of the identity creation payload. Here’s how you can do it: ### Example cURL Command Replace the placeholders with your actual values:
Copy code
bash curl --request POST \   --header "Authorization: Bearer <ORY_ACCESS_TOKEN>" \   --header "Content-Type: application/json" \   --data '{     "schema_id": "<preset://email>",     "traits": {       "email": "<mailto:user@example.org|user@example.org>"     },     "credentials": {       "password": {         "config": {           "hashed_password": "$argon2id$v=19$m=32,t=2,p=4$cm94YnRVOW5jZzFzcVE4bQ$MNzk5BtR2vUhrp6qQEjRNw"         }       }     }   }' \   https://<YOUR_PROJECT_SLUG>.<http://projects.oryapis.com/admin/identities|projects.oryapis.com/admin/identities>
The value for
hashed_password
should be the Argon2 hash string you have from your provider. The format is:
Copy code
$argon2id$v=<version>$m=<memory>,t=<iterations>,p=<parallelism>$<hash>
[Importing Argon2 hashed passwords](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities#hashed-passwords) ### Kratos Configuration YAML To ensure that Ory Kratos can accept and migrate Argon2 hashes, you should configure the password hasher in your
config.yml
. By default, Kratos uses BCrypt, but you can set it to Argon2id if you want new passwords to be hashed with Argon2id:
Copy code
yaml hashers:   algorithm: argon2   argon2:     parallelism: 1     memory: 128MB     iterations: 3     salt_length: 16     key_length: 32
[Kratos password hashing configuration](https://www.ory.sh/docs/self-hosted/kratos/configuration/password) Note: - Ory Kratos can compare stored Argon2 hashes and, if your configured hasher is different (e.g., BCrypt), it will migrate the password to the new algorithm on the next successful login. - You do not need to set the hasher to Argon2id to import Argon2 hashes, but doing so will keep the hashing algorithm consistent for new passwords. --- If you need to import multiple users, use the [Identity Import API](https://www.ory.sh/docs/kratos/manage-identities/import-user-accounts-identities#bulk-import-identities-from-other-providers) with a similar payload structure for each user.