Keycloak - Create Admin User in a Realm

前端 未结 4 651
傲寒
傲寒 2021-02-04 12:28

How do I create an admin user in a realm in Keycloak? I tried /bin/add-user.sh -r myrealm -u admin -p It gave me the error:


 * Error *
         


        
4条回答
  •  遇见更好的自我
    2021-02-04 12:56

    Pleas have a look in this command

    /bin/add-user.sh -r myrealm -u admin -p 
    

    here you are trying to run a shell script which will create a user admin with some password under realm myrealm .

    So its mandatory myrealm realm should exist before you are going to create a user under it.

    If this is not working try to create a user under master realm which is default realm exist after keycloak installation.

    Id you are not aware how to create realm ,here are some of the admin-cli and curl commands to do so

    How to create realm with the help of admin-cli

    /opt/keycloak/bin/kcadm.sh create realms -s realm= -s id="" -s enabled=true -s 
    

    How to create realm with the help of curl command

    curl -v :/auth/admin/realms -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" --data  '{"realm":"Realm-name","id":"Realm-id","enabled":"true"}' -k
    

提交回复
热议问题