Skip to main content

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_callback

...

app = App()
register_auth_callback(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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reflex_okta_auth-0.1a0.tar.gz (121.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reflex_okta_auth-0.1a0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file reflex_okta_auth-0.1a0.tar.gz.

File metadata

  • Download URL: reflex_okta_auth-0.1a0.tar.gz
  • Upload date:
  • Size: 121.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for reflex_okta_auth-0.1a0.tar.gz
Algorithm Hash digest
SHA256 9cdce97edaf7786240d45e6a2dec0e9c7be1ec7da15307a46673075adccdea1f
MD5 f51e2e4b00f927c849b96c385bfcd026
BLAKE2b-256 fed58201d6a1632ed649f3e1716106f00c48c70f091e457c156a1d4e004e0a3a

See more details on using hashes here.

File details

Details for the file reflex_okta_auth-0.1a0-py3-none-any.whl.

File metadata

File hashes

Hashes for reflex_okta_auth-0.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 d556297f0327f47ded5216252c84621266f561e8c842a48185e94a91f8cbd19b
MD5 94cbce6c59d8ab56493b37c5054d2ece
BLAKE2b-256 c5a6c656a13de09516f7c3fd51e54978b1040a8e44ef69f5f5ad9dc5bd1dc475

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page