Skip to main content

Streamlit Keycloak

Keycloak authentication inside your Streamlit app

Installation

pip install streamlit-keycloak

Usage

Creating a Keycloak component will perform authentication when the app is rendered. Credentials can be provided in the popup window. Outside of a SSO environment, you must allow popups to be able to log in.

The component returns a tuple containing the authentication state, OAuth2 token and user info respectively. If a refresh token is present, tokens are refreshed automatically. This will rerender the app.

Example

from streamlit_keycloak import keycloak
import streamlit as st


def main():
    st.subheader(f"Welcome {user_info['preferred_username']}!")
    st.write(f"Here is your OAuth2 token: {token}")


authenticated, token, user_info = keycloak(
    url="http://localhost:8080",
    realm="myrealm",
    client_id="myclient",
)

st.title("Streamlit Keycloak example")

if authenticated:
    main()

else:
    st.write("Authenticating...")

streamlit-keycloak showcase|639x663

Todo

  • Logout functionality?

Metadata

Release files for streamlit-keycloak 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for streamlit-keycloak 0.1.4
File Size Uploaded Provenance Actions
streamlit-keycloak-0.1.4.tar.gz 422.8 kB Without provenance Details for streamlit-keycloak-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for streamlit-keycloak 0.1.4
File Interpreter ABI Platform Actions
streamlit_keycloak-0.1.4-py3-none-any.whl Python 3 none any Details for streamlit_keycloak-0.1.4-py3-none-any.whl

Total release size: 851.9 kB

Release files / streamlit-keycloak-0.1.4.tar.gz

Download URL streamlit-keycloak-0.1.4.tar.gz
Size 422.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e2739194d83af58a7196d7881aff5e432938771afcb689eb9b8184294a6a5b05
BLAKE2b-256 checksum
How to use checksums
c91e702b04576aeb3ade360f7b4cd651f01a29caee92d228fd397176149d9f10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Release files / streamlit_keycloak-0.1.4-py3-none-any.whl

Download URL streamlit_keycloak-0.1.4-py3-none-any.whl
Size 429.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63b0f6c83be99380dd3834f6c83695f6315637600f48f943dc5ae5d838514ff1
BLAKE2b-256 checksum
How to use checksums
8169d522d97a783f70bf7427f7d157ce4967d206e583a37996131076bdaa0d93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Security for streamlit-keycloak 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page