-2

Am trying to access Keycloak Admin for getting the user information with following code. Am getting 403 error while executing any GET commands.Can anyone help or have seen this in error. Am getting 'None' when am priniting, print(keycloak_admin1.get_token()).

from keycloak import keycloak_admin
keycloak_admin1 = keycloak_admin.KeycloakAdmin(server_url=endpoint,username=username, password=password,realm_name=realmname,client_id= clientid,client_secret_key=clientsecret,verify= True)
print(keycloak_admin1.realm_name)
print(keycloak_admin1.token)

# User counter
count_users = keycloak_admin1.users_count()
getusers = keycloak_admin1.get_user()
print(count_users)
Rakesh Gupta
  • 139
  • 8

1 Answers1

0

I ended up using Keycloak API's and it resolved my issue. Still not sure why python.keycloak package not working. So marking this issue done.

Rakesh Gupta
  • 139
  • 8
  • Hello @rakesh gupta, can you give a short description of what you have done to resolve? thanks – Mohiuddin Sumon Aug 17 '20 at 04:31
  • We went API's route, as python.keycloak package was not working. We called the Login API to get the acces token and then used that token to access users attrbute. Let me know for any more information. – Rakesh Gupta Aug 21 '20 at 04:36