Skip to main content

Dash Okta OAuth2

Dash Okta Auth is a simple library using Okta OAuth2 to authenticate and view a Dash app.

This Library uses Flask Dance and a modified version of Plotly's own dash auth for authentication.

This Library is heavily inspired by dash-google-oauth created by Lucas Chapin and forked from dash-okta-auth created by Frank Spijkerman.

I decided to deploy to pip after I received no response to this issue.

Basic Use

Authentication can be added to your Dash application using the OktaOAuth class, i.e.

from dash import Dash
from flask import Flask
from dash_okta_oauth2 import OktaOAuth

server = Flask(__name__)
server.config.update({
  'OKTA_OAUTH_CLIENT_ID': ...,
  'OKTA_OAUTH_CLIENT_SECRET': ...,
  'OKTA_BASE_URL': ...
})

app = Dash(__name__, server=server, url_base_pathname='/')


additional_scopes = [...]
auth = OktaOAuth(app, additional_scopes)

# your Dash app here :)
...

Example

Steps to try this out yourself:

  1. Install the dash-okta-auth library using pip:

    $ pip install dash-okta-oauth2
    
  2. Follow the Flask Dance Guide to create an app on the okta admin console

  3. Make a copy of app.py and set the variables (or set the corresponding environment variables):

    server.config["OKTA_OAUTH_CLIENT_ID"] = ...
    server.config["OKTA_OAUTH_CLIENT_SECRET"] = ...
    

    with values from the Okta OAuth 2 application you should have set up earlier. If you've set these up properly, you can find them at Applications > yourapp > General under the section Client Credentials.

  4. Run python app.py and open localhost in a browser window to try it out! If the app loads automatically without prompting a Okta login, that means you're already authenticated -- try using an inokta window in this case if you want to see the login experience for a new user.

Release files for dash-okta-oauth2 0.0.2

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

Source distribution (sdist)

Source distribution for dash-okta-oauth2 0.0.2
File Size Uploaded
dash-okta-oauth2-0.0.2.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dash-okta-oauth2 0.0.2
File Interpreter ABI Platform
dash_okta_oauth2-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 12.3 kB

Release files / dash-okta-oauth2-0.0.2.tar.gz

Download URL dash-okta-oauth2-0.0.2.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fedd75eea4f5a6e94d905ee75e7534e231d669933b4d374e042d4fe328b3d4f8
BLAKE2b-256 checksum
How to use checksums
4066e0fed3089539dd77dcb9f2ec625d3ea52025c34727e01535dfa2c1c137f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

Release files / dash_okta_oauth2-0.0.2-py3-none-any.whl

Download URL dash_okta_oauth2-0.0.2-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6e24652ab3caf7fc747e1a0267052480539dc2639ea5bdeacac1bd6a2d4b5a0
BLAKE2b-256 checksum
How to use checksums
1acb10ff148b92b40e7c44ce01bbeb922a7cdae514c75364a6d07834d6b5bf57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

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