Skip to content

Instantly share code, notes, and snippets.

@iarenaza
Last active October 4, 2019 15:04
Show Gist options
  • Save iarenaza/0a87b35935e6d217eb714affe6c5e154 to your computer and use it in GitHub Desktop.
Save iarenaza/0a87b35935e6d217eb714affe6c5e154 to your computer and use it in GitHub Desktop.
testkeycloak.py
#!/usr/bin/env python
# You need to install python-keycloak for this to work. Do:
#
# pip install python-keycloak
#
# first
from keycloak import KeycloakOpenID
keycloak_openid = KeycloakOpenID(server_url="https://xxxxx.yyyyy/auth/",
client_id="xxxx-xxxx-xxxx",
realm_name="yyyyyyyy")
token = keycloak_openid.token("username", "password", scope="openid email")
id_token = token['id_token']
print(id_token)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment