You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
yang2lalang
changed the title
keycloak_open id introspect function doesn't return correct user information after modification
keycloak_open_id introspect function doesn't return correct user information after modification
Aug 9, 2023
Isn't this expected? I'd expect that introspect just looks into the data in the generated token, it doesn't perform lookups in the keycloak database as userinfo does. I'm pretty sure however that if you refresh the access token after changing the user data, the introspect will give you the correct information.
Consider a change to user information
`
new_user_id = keycloak_admin.get_user_id(params["email"])
payload = {
"firstName": params["first_name"],
"lastName": params["last_name"],
"enabled": True,
}
keycloak_admin.update_user(new_user_id, payload)
`
After this change a call to introspect to obtain updated user info still contains old first_name and last_name
`
principal = keycloak_openid_client.introspect(access_token)
print("\n introspected principal (not updated: wrong)*************")
print(principal)
userinfo = keycloak_openid_client.userinfo(access_token)
print("\n introspected userinfo (updated correct) *************")
print(userinfo)
`
it seems the issue is from the keycloak server:
i'm having to do:
`
principal.update(userinfo)
print(principal)
`
The text was updated successfully, but these errors were encountered: