fastapi-keycloak icon indicating copy to clipboard operation
fastapi-keycloak copied to clipboard

Create clients from library

Open GratienDSX opened this issue 2 years ago • 1 comments

Hello there, thank you for this library that looks great.

I haven't found the possibility to create clients programmatically directly from the library, is it something planned? If not, I might open a PR to do so.

GratienDSX avatar Jul 27 '22 15:07 GratienDSX

Hi @GratienDSX , I think it's possible to create clients programmatically it'll be something like this

idp = FastAPIKeycloak(
    server_url="http://localhost:8085/auth",
    client_id="test-client",
    client_secret="GzgACcJzhzQ4j8kWhmhazt7WSdxDVUyE",
    admin_client_secret="BIcczGsZ6I8W5zf0rZg5qSexlloQLPKB",
    realm="Test",
    callback_uri="http://localhost:8081/callback"
)
idp.create_user(first_name=first_name, last_name=last_name, username=email, email=email, \
password=password.get_secret_value(), id=id)

Jonatha-Varjao avatar Aug 22 '22 19:08 Jonatha-Varjao