# Setup user registration with Keycloak API through Postman

**URL:** <https://forum.keycloak.org/t/setup-user-registration-with-keycloak-api-through-postman/25794>\
**Category:** Getting advice\
**Created:** [April 30, 2024, 1:37pm UTC](https://forum.keycloak.org/t/setup-user-registration-with-keycloak-api-through-postman/25794 "2024-04-30T13:37:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![duskox](https://avatars.discourse-cdn.com/v4/letter/d/df705f/32.png) [@duskox](https://forum.keycloak.org/u/duskox)\
**Post date:** [April 30, 2024, 1:37pm UTC](https://forum.keycloak.org/t/setup-user-registration-with-keycloak-api-through-postman/25794/1 "2024-04-30T13:37:48Z")

</div>

Hi everyone,

Keycloak first timer here. I wanted to test Keycloak with Postman so that I understand all the things I need to do and setup before starting to use it. I am aiming to having a Keycloak being used via it’s API. So I would like to be able to have my _FrontendApp_ to have a user registration form and then I will make an API call to Keycloak to register that user, with maybe email verification.

Then, this user can login with username/password, where frontend obtains a session token. From then on, all access to _BackendApp_ API is done with this session token, that then in the backend I use to verify against Keycloak API that token is valid and to obtain user info.

_Anyway, I believe this is all known and I am just repeating it to be sure I don’t miss out a detail._

1. I have created **myRealm** and I created two clients, **postman-FE** and **postman-BE**.
2. Both clients have **client authentication** ON
3. Both clients have **client\_secret** and **Client Authenticator** option is _Client Id and Secret_.

I then try to call the **Register new user** endpoint but I get error 401 UNAUTHORIZED.

request:POST [http://localhost:8080/admin/realms/myRealm/users](http://localhost:8080/admin/realms/myRealm/users)  
body: {  
“firstName”: “fName”,  
“lastName”: “lName”,  
“username”: “fnln”,  
“[email":"some\_email@domain.com](mailto:email%22:%22some_email@domain.com)”,  
“emailVerified”: true,  
“enabled”: true,  
“attributes”: {},  
“groups”:   
}

For this request I have entered client\_id and client\_secret into Postman when I choose Basic auth in the Authentication tab.

Then I think I need to authenticate a client, so my Postman requests. I am guessing I should do this with the following two endpoints:  
_{{url}}/realms/{{realm}}/protocol/openid-connect/auth_  
_{{url}}/realms/{{realm}}/protocol/openid-connect/token_

names in {{ }} are variables set in Postman if you never used it.

I am not sure how to access these endpoint and actually authenticate. What should be the params, as whatever I provide doesn’t work. I tried using basic auth in Authorization tab in Postman. I tried using header params with _client\_id_ and _client\_secret_ but no success.

I am out of ideas. Thanks for any pointers!

---

<div class="post-metadata">

**Author:** ![vietanh2909](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/vietanh2909/32/10330_2.png) [@vietanh2909](https://forum.keycloak.org/u/vietanh2909)\
**Post date:** [May 1, 2024, 5:05am UTC](https://forum.keycloak.org/t/setup-user-registration-with-keycloak-api-through-postman/25794/2 "2024-05-01T05:05:48Z")

</div>

_{{url}}/realms/{{realm}}/protocol/openid-connect/token_  
You must use account admin to get access token, after use it to create new user.  
On header you use Bearer Token.

---

<div class="post-metadata">

**Author:** ![duskox](https://avatars.discourse-cdn.com/v4/letter/d/df705f/32.png) [@duskox](https://forum.keycloak.org/u/duskox)\
**Post date:** [May 1, 2024, 9:44am UTC](https://forum.keycloak.org/t/setup-user-registration-with-keycloak-api-through-postman/25794/3 "2024-05-01T09:44:23Z")

</div>

What do you mean that I need to use account admin? I tried with all user combinations.

---

<div class="post-metadata">

**Author:** ![ThoreKr](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/thorekr/32/7713_2.png) [@ThoreKr](https://forum.keycloak.org/u/ThoreKr)\
**Post date:** [May 1, 2024, 2:05pm UTC](https://forum.keycloak.org/t/setup-user-registration-with-keycloak-api-through-postman/25794/4 "2024-05-01T14:05:34Z")

</div>

That’s not the way keycloak is supposed to be used. Credential management, registration, etc. should be handled through keycloaks built-in flows, not via a MITM attack.

---

<div class="post-metadata">

**Author:** ![duskox](https://avatars.discourse-cdn.com/v4/letter/d/df705f/32.png) [@duskox](https://forum.keycloak.org/u/duskox)\
**Post date:** [May 1, 2024, 7:42pm UTC](https://forum.keycloak.org/t/setup-user-registration-with-keycloak-api-through-postman/25794/5 "2024-05-01T19:42:01Z")

</div>

Ok, could you please point me to the right flow documentation for user registration via API, if that’s possible? If not I think I saw it’s possible to build a template for user login/registration? within Keycloak.

---

<div class="post-metadata">

**Author:** ![ThoreKr](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/thorekr/32/7713_2.png) [@ThoreKr](https://forum.keycloak.org/u/ThoreKr)\
**Post date:** [May 4, 2024, 1:16pm UTC](https://forum.keycloak.org/t/setup-user-registration-with-keycloak-api-through-postman/25794/6 "2024-05-04T13:16:03Z")

</div>

Yes you can customize the themes. [Server Developer Guide](https://www.keycloak.org/docs/latest/server_development/#_themes) gives a short introduction. The registration template is pat of the login theme. Depending on your timeline it might make sense to directly look into the v2 theme, which is currently in preview.

Adapting the login theme will allow you to customize everything login, registration etc. For self-service you’ll have to look into the account theme.
