Archived
This project has been archived by its maintainers, and is no longer receiving any updates.
reflex-okta-auth
This package requires the reflex_enterprise package to be installed.
Installation
pip install reflex-okta-auth
Usage
Set Up Okta Application
Create a new Application and set up a .env file with the following variables:
OKTA_CLIENT_ID=your_client_id
OKTA_CLIENT_SECRET=your_client_secret
OKTA_ISSUER_URI=your oauth issuer uri
Reflex will need to access these variables to authenticate users.
Register Auth Callback
from reflex_enterprise import App
from reflex_okta_auth import register_auth_endpoints
...
app = App()
register_auth_endpoints(app)
Check OktaAuthState.userinfo for user identity/validity
import reflex as rx
from reflex_okta_auth import OktaAuthState
@rx.page()
def index():
return rx.container(
rx.vstack(
rx.heading("Okta Auth Demo"),
rx.cond(
rx.State.is_hydrated,
rx.cond(
OktaAuthState.userinfo,
rx.vstack(
rx.text(f"Welcome, {OktaAuthState.userinfo["name"]}!"),
rx.text(OktaAuthState.userinfo.to_string()),
rx.button("Logout", on_click=OktaAuthState.redirect_to_logout),
),
rx.button("Log In with Okta", on_click=OktaAuthState.redirect_to_login),
),
rx.spinner(),
),
),
)
Validate the Tokens
Before performing privileged backend operations, it is important to validate the
tokens to ensure they have not been tampered with. Use
OktaAuthState._validate_tokens() helper method to validate the tokens.
Metadata
Release files for reflex-okta-auth 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| reflex_okta_auth-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Release files / reflex_okta_auth-0.2.1-py3-none-any.whl
| Download URL | reflex_okta_auth-0.2.1-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf6936de3bb5eb6bd01d4b188e8cc31eff222155ab6d907e6cb2d282412340eb
|
|
BLAKE2b-256 checksum How to use checksums |
487fa7d6c3e9c759b1833023c9d6f82bdfb0722ce8e062ab6593bce3ac529819
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|