- Open the "admin-cli" client in your realm (my-realm)
- In the Service Accounts Roles assing "realm-admin" and "manage users" roles
Last active
May 4, 2023 07:46
-
-
Save longdog/10b3f011c36cd9e0b7a5a77387ccec95 to your computer and use it in GitHub Desktop.
keycloak add users by curl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
access_token=`curl -d "client_id=admin-cli" -d "client_secret=#####" -d "grant_type=client_credentials" "http://localhost:8080/realms/my-realm/protocol/openid-connect/token" | jq -r .access_token` | |
curl -X POST -H "Authorization: Bearer $access_token" -H 'Accept: application/json' -H 'Content-Type: application/json' -d @u.json http:/localhost:8080/admin/realms/my-realm/partialImport |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"users": [ | |
{ | |
"username": "ivan", | |
"email": "[email protected]", | |
"firstName": "Ivan", | |
"lastName": "Ivanov", | |
"emailVerified": true, | |
"enabled": true | |
} | |
], | |
"policy": "SKIP" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment