Integration with Okta server-side SSO
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reflex_okta_auth-0.2.0-py3-none-any.whl.
File metadata
- Download URL: reflex_okta_auth-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7ee7bd13504a48a33b41a927f9a9885f8ae51bc23a18acb6bad386c0b8c929a
|
|
| MD5 |
997ea4b011099424a839af7ebe322ae1
|
|
| BLAKE2b-256 |
4dd65b1b2f15e0b28aaf4ba73ffaa8f00d62b773b8474c3c757034d756619963
|