Returning auth extra information on launch

I have integrated a small demo with some login API but I want to store in the session state the username entered in that login.

Is there a way to access it?

def keycloak_auth(username, password):
    keycloak_openid = KeycloakOpenID(
        server_url="", client_id="", realm_name=""
    )
    # Get Token
    token = keycloak_openid.token(username, password)
    gr.Text(value=username, label="username")

    return token


demo.launch(auth=keycloak_auth, auth_message="Enter your credentials", enable_queue=True)

1 Like

I have the exact same need…

Look at gr.State() and Interface State. This lets you store a state across pages per user.