# reflex-okta-auth
This package requires the `reflex_enterprise` package to be installed.
## Installation
```bash
pip install reflex-okta-auth
```
## Usage
### Set Up Okta Application
Create a new Application and set up a .env file with the following variables:
```env
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
```python
from reflex_enterprise import App
from reflex_okta_auth import register_auth_callback
...
app = App()
register_auth_callback(app)
```
### Check `OktaAuthState.userinfo` for user identity/validity
```python
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.
Raw data
{
"_id": null,
"home_page": null,
"name": "reflex-okta-auth",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "python, reflex, reflex-enterprise",
"author": null,
"author_email": "Masen Furer <masen@reflex.dev>",
"download_url": null,
"platform": null,
"description": "# reflex-okta-auth\n\nThis package requires the `reflex_enterprise` package to be installed.\n\n## Installation\n\n```bash\npip install reflex-okta-auth\n```\n\n## Usage\n\n### Set Up Okta Application\n\nCreate a new Application and set up a .env file with the following variables:\n\n```env\nOKTA_CLIENT_ID=your_client_id\nOKTA_CLIENT_SECRET=your_client_secret\nOKTA_ISSUER_URI=your oauth issuer uri\n```\n\nReflex will need to access these variables to authenticate users.\n\n### Register Auth Callback\n\n```python\nfrom reflex_enterprise import App\nfrom reflex_okta_auth import register_auth_callback\n\n...\n\napp = App()\nregister_auth_callback(app)\n```\n\n### Check `OktaAuthState.userinfo` for user identity/validity\n\n```python\nimport reflex as rx\nfrom reflex_okta_auth import OktaAuthState\n\n@rx.page()\ndef index():\n return rx.container(\n rx.vstack(\n rx.heading(\"Okta Auth Demo\"),\n rx.cond(\n rx.State.is_hydrated,\n rx.cond(\n OktaAuthState.userinfo,\n rx.vstack(\n rx.text(f\"Welcome, {OktaAuthState.userinfo[\"name\"]}!\"),\n rx.text(OktaAuthState.userinfo.to_string()),\n rx.button(\"Logout\", on_click=OktaAuthState.redirect_to_logout),\n ),\n rx.button(\"Log In with Okta\", on_click=OktaAuthState.redirect_to_login),\n ),\n rx.spinner(),\n ),\n ),\n )\n```\n\n### Validate the Tokens\n\nBefore performing privileged backend operations, it is important to validate the\ntokens to ensure they have not been tampered with. Use\n`OktaAuthState._validate_tokens()` helper method to validate the tokens.\n",
"bugtrack_url": null,
"license": null,
"summary": "Integration with Okta server-side SSO",
"version": "0.1.0",
"project_urls": {
"documentation": "https://enterprise.reflex.dev",
"homepage": "https://reflex.dev/"
},
"split_keywords": [
"python",
" reflex",
" reflex-enterprise"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "fee2a726db84c1d25dd2b73af1ff91e2b2efbd9d4563a7a4d0514d1234df2192",
"md5": "73b0cec00f0de11983f359226a97f349",
"sha256": "058b5176355499be7fa68f40ab318822e3defb100d79f8dbbaa508ad9954375e"
},
"downloads": -1,
"filename": "reflex_okta_auth-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "73b0cec00f0de11983f359226a97f349",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 5630,
"upload_time": "2025-07-24T17:10:28",
"upload_time_iso_8601": "2025-07-24T17:10:28.305409Z",
"url": "https://files.pythonhosted.org/packages/fe/e2/a726db84c1d25dd2b73af1ff91e2b2efbd9d4563a7a4d0514d1234df2192/reflex_okta_auth-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-24 17:10:28",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "reflex-okta-auth"
}