I have the same problem like this: Create a new user in Keycloak using Postman
So, I also want to create a user, and I'm also getting 401, unauthorized. So I must using wrong token! So how I created token?
In my case: I've created a new Realm, called "Lifetrenz" In this Realm, I've created a user called: "Test" username & password: test client_id : I created lifetrenz-client-1 grant_type : password.
I know that I should not use already created user credentials, then what should I use? If I use my admin credentials (what I used to try login in Keycloak dashboard) then saying invalid grant / credentials.
Two problems:
- If I use admin credentails to generate token, then I'm getting 400 invalid grant / credentials
- If I use user credential to generate token, it'll generate, then while creating user, I'm getting 401, unauthorized access.
FYI:
How I create user: URL: http://localhost:8080/auth/admin/realms/Lifetrenz/users and passing Beared token from Auth - Type