Hi all,

I referred to the doc[0] regarding Initial Access Token and generated a new token for my realm.

I'm using the python requests library to invoke the GET realms API[1] but I get a 401 Unauthorized status code. Am I doing it wrong? Below is my code.

import requests
authorization = {'Authorization': 'Bearer eyJhbGciOiJS.<redacted>'}

response = requests.get('http://keycloak-server.com/auth/admin/realms', headers=authorization)
response.status_code // 401


[0] https://keycloak.github.io/docs/userguide/keycloak-server/html/client-registration.html#d4e1450
[1] http://keycloak.github.io/docs/rest-api/index.html#_get_accessible_realms

--
KUNAL KERKAR | PRODUCT ENGINEER
Plivo, Inc. 340 Pine St, San Francisco - 94104, USA
Web: www.plivo.com | Twitter: @plivo@tsudot