<div dir="ltr">Hi all,<div><br></div><div>I referred to the doc[0] regarding Initial Access Token and generated a new token for my realm.</div><div><br></div><div>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.</div><div><br></div><div></div><div class="markdown-here-wrapper" style=""><pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248);white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important">import requests
authorization = {'Authorization': 'Bearer eyJhbGciOiJS.<redacted>'}
response = requests.get('<a href="http://keycloak-server.com/auth/admin/realms">http://keycloak-server.com/auth/admin/realms</a>', headers=authorization)
response.status_code // 401
</code></pre><div title="MDH:PGRpdj5gYGA8L2Rpdj48ZGl2PmltcG9ydCByZXF1ZXN0czwvZGl2PjxkaXY+CgoKCgoKCgo8cCBj
bGFzcz0iIj48c3BhbiBjbGFzcz0iIj5hdXRob3JpemF0aW9uID0geydBdXRob3JpemF0aW9uJzog
J0JlYXJlciBleUpoYkdjaU9pSlNVekkxTmlKOS5leUpxZEdrLi4uJmx0O3JlZGFjdGVkJmd0Oyd9
PC9zcGFuPjwvcD48cCBjbGFzcz0iIj48c3BhbiBjbGFzcz0iIj4KCgoKCgoKCjwvc3Bhbj48L3A+
PHAgY2xhc3M9IiI+PHNwYW4gY2xhc3M9IiI+cmVzcG9uc2UgPSByZXF1ZXN0cy5nZXQoJ2h0dHA6
Ly9rZXljbG9hay1zZXJ2ZXIuY29tL2F1dGgvYWRtaW4vcmVhbG1zJywgaGVhZGVycz1hdXRob3Jp
emF0aW9uKTwvc3Bhbj48L3A+PHAgY2xhc3M9IiI+PHNwYW4gY2xhc3M9IiI+cmVzcG9uc2Uuc3Rh
dHVzX2NvZGUgLy8mbmJzcDs8L3NwYW4+NDAxPC9wPjxwIGNsYXNzPSIiPmBgYDwvcD48L2Rpdj4=" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0"></div></div><div><p class=""></p>
</div><div><br></div><div>[0] <a href="https://keycloak.github.io/docs/userguide/keycloak-server/html/client-registration.html#d4e1450">https://keycloak.github.io/docs/userguide/keycloak-server/html/client-registration.html#d4e1450</a><br clear="all"><div>[1] <a href="http://keycloak.github.io/docs/rest-api/index.html#_get_accessible_realms">http://keycloak.github.io/docs/rest-api/index.html#_get_accessible_realms</a></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><b style="font-size:small;font-family:tahoma,sans-serif">KUNAL KERKAR </b><font color="#666666" style="font-size:small;font-family:tahoma,sans-serif">| PRODUCT ENGINEER</font><br></div><div><div dir="ltr"><div style="font-size:small;font-family:arial"><div><span style="color:rgb(102,102,102);font-family:tahoma,sans-serif;font-size:13px;line-height:16.12px">Plivo, Inc. 340 Pine St, San Francisco - 94104, USA</span><font face="tahoma, sans-serif"><font color="#666666"><br></font></font></div><div><font face="tahoma, sans-serif"><font color="#666666">Web:</font> <a href="http://www.plivo.com/" style="color:rgb(17,85,204)" target="_blank">www.plivo.com</a> <font color="#666666">| Twitter:</font> <a href="http://twitter.com/plivo" style="color:rgb(17,85,204)" target="_blank">@plivo</a>, <a href="http://twitter.com/tsudot" style="color:rgb(17,85,204)" target="_blank">@tsudot</a></font></div><div><div dir="ltr" style="font-family:arial,sans-serif;font-size:12.8px"><div style="font-size:small;font-family:arial"><div><br></div><div><a href="https://www.plivo.com/sms-short-code/?utm=emailsig" style="color:rgb(17,85,204);font-family:tahoma,sans-serif" target="_blank">Free Incoming SMS for All US Short Codes – Get One Today!</a></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div></div>