Snorre Hukkelås
Snorre Hukkelås

Reputation: 145

Creating Keycloak user from docker container

I am having problems creating users using the Keycloak REST API from my docker container running a Django application. The following works using postman:

  1. Fetch admin token enter image description here
  2. Create user: enter image description here

The following does NOT work in python, and returns 401 Unauthorized:

  1. Fetch admin toke (This successfully returns a token): enter image description here
  2. Create user (This returns 401): enter image description here

I am using the exact same user credentials in both scenarios,and since I am able to get this to work in postman I don't think there's any problem with access/roles etc.

Any help is greatly appreciated. Thanks!

Upvotes: 0

Views: 687

Answers (1)

PDHide
PDHide

Reputation: 19939

You are not givingspace after "Bearer" so instead of "Bearer"+ token , use "Bearer " + token

you can also geenrate python code from postman :

click code:

enter image description here

Search for python

enter image description here

copy paste the generated code

Upvotes: 2

Related Questions