Melom
Melom

Reputation: 608

Python Keycloak - There is a way to get user by email?

I need to retrieve a user by his email. How can I achieve this?

Im using Python 3.10 with the library python-keycloak (https://pypi.org/project/python-keycloak/) but there isn't a method to achieve this.

Someone know how to do this? Really thanks

Upvotes: 1

Views: 2637

Answers (1)

Paul
Paul

Reputation: 334

Python keycloak is just a wrapper that passes the parameters to keycloak rest endpoint for users. In the REST api docs for users resource you can see that the query param email can be passed.

Your code should look like this:

users = keycloak_admin.get_users({"email":"[email protected]"})

Upvotes: 1

Related Questions