Open kbumsik opened 6 months ago
Hi,
Thank you for making a proper org feature in Keycloak!
We have been using keycloak-org for weeks with this Python client.
I noticed that python-keycloak package automatically refresh token when the token is expired, but this package does not.
Because of this, every time I make a request I have to refresh token (when expired) and create phasetwo.Configuration and phasetwo.ApiClient
phasetwo.Configuration
phasetwo.ApiClient
keycloak_admin = KeycloakAdmin(server_url="https://my-keycloak-host/auth/", username='admin', password='password', realm_name=realm, client_id='admin-cli', verify=True) # Before making a request if (keycloak_admin.connection.expires_at is None) or (datetime.now() >= keycloak_admin.connection.expires_at): keycloak_admin.connection.refresh_token() configuration = phasetwo.Configuration( host = "https://app.phasetwo.io/auth/realms" access_token = keycloak_admin.token() ) client = phasetwo.ApiClient(configuration)
Devs won't notice this until they come across this issue.
Good catch. I wasn't sure if calling the token() method automatically got a fresh token. Would you mind doing the PR?
token()
Maybe I will think about proposing a PR after my current dev sprint at work ends 😝
Hi,
Thank you for making a proper org feature in Keycloak!
We have been using keycloak-org for weeks with this Python client.
I noticed that python-keycloak package automatically refresh token when the token is expired, but this package does not.
Because of this, every time I make a request I have to refresh token (when expired) and create
phasetwo.Configuration
andphasetwo.ApiClient
Devs won't notice this until they come across this issue.