Plotly Dash plugin to allow authentication through 3rd party OAuth providers.

Overview

build

dash-auth-external

Integrate your dashboards with 3rd parties and external OAuth providers.

Overview

Do you want to build a Plotly Dash app which pulls user data from Google, Spotify, Slack etc?

Dash-auth-external provides a simple interface to authenticate users through OAuth2 code flow. Allowing developers to serve user tailored content.

Installation

Dash-auth-external is distributed via PyPi

pip install dash-auth-external

Simple Usage

#using spotify as an example
AUTH_URL = "https://accounts.spotify.com/authorize"
TOKEN_URL = "https://accounts.spotify.com/api/token"
CLIENT_ID = "YOUR_CLIENT_ID"

# creating the instance of our auth class
auth = DashAuthExternal(AUTH_URL, TOKEN_URL, CLIENT_ID)

We then pass the flask server from this object to dash on init.

app = Dash(__name__, server= auth.server)

That's it! You can now define your layout and callbacks as usual.

To obtain your access token, call the get_token method of your Auth object. NOTE This can ONLY be done in the context of a dash callback.

app.layout = html.Div(
[
html.Div(id="example-output"), 
dcc.Input(id="example-input")
])

@app.callback(
Output("example-output", "children"),
Input("example-input", "value")
)
def example_callback(value):
    token = (
        auth.get_token()
    )  ##The token can only be retrieved in the context of a dash callback
    return token

Feature Roadmap

  • OAuth2 support
  • OAuth1 support
  • Full test coverage
  • Multiple OAuth Providers
  • Support for PKCE/ non-PKCE
You might also like...
A generic, spec-compliant, thorough implementation of the OAuth request-signing logic
A generic, spec-compliant, thorough implementation of the OAuth request-signing logic

OAuthLib - Python Framework for OAuth1 & OAuth2 *A generic, spec-compliant, thorough implementation of the OAuth request-signing logic for Python 3.5+

Doing the OAuth dance with style using Flask, requests, and oauthlib.

Flask-Dance Doing the OAuth dance with style using Flask, requests, and oauthlib. Currently, only OAuth consumers are supported, but this project coul

This is a Python library for accessing resources protected by OAuth 2.0.

This is a client library for accessing resources protected by OAuth 2.0. Note: oauth2client is now deprecated. No more features will be added to the l

A Python library for OAuth 1.0/a, 2.0, and Ofly.

Rauth A simple Python OAuth 1.0/a, OAuth 2.0, and Ofly consumer library built on top of Requests. Features Supports OAuth 1.0/a, 2.0 and Ofly Service

The ultimate Python library in building OAuth, OpenID Connect clients and servers. JWS,JWE,JWK,JWA,JWT included.

Authlib The ultimate Python library in building OAuth and OpenID Connect servers. JWS, JWK, JWA, JWT are included. Authlib is compatible with Python2.

Doing the OAuth dance with style using Flask, requests, and oauthlib.

Flask-Dance Doing the OAuth dance with style using Flask, requests, and oauthlib. Currently, only OAuth consumers are supported, but this project coul

Doing the OAuth dance with style using Flask, requests, and oauthlib.

Flask-Dance Doing the OAuth dance with style using Flask, requests, and oauthlib. Currently, only OAuth consumers are supported, but this project coul

Phishing Abusing Microsoft 365 OAuth Authorization Flow
Phishing Abusing Microsoft 365 OAuth Authorization Flow

Microsoft365_devicePhish Abusing Microsoft 365 OAuth Authorization Flow for Phishing Attack This is a simple proof-of-concept script that allows an at

Abusing Microsoft 365 OAuth Authorization Flow for Phishing Attack
Abusing Microsoft 365 OAuth Authorization Flow for Phishing Attack

Microsoft365_devicePhish Abusing Microsoft 365 OAuth Authorization Flow for Phishing Attack This is a simple proof-of-concept script that allows an at

Comments
  • Outdated PYPI

    Outdated PYPI

    Hi, I noticed that the master branch differs from the pypi version, when using the pypi version there is a dict error that appears which is resolved in the GitHub branch. Could you update the pypi version as well? Lastly, I keep getting a key error but as far as I can tell my token field name is correct. I am using O2Auth with openID connect.

    token = auth.get_token()
    File "auth.py", line 27, in get_token
    raise KeyError(
    KeyError: 'Header with name access_token not found in the flask request headers.'
    

    Here is my method:

    auth = DashAuthExternal(
                            external_auth_url= AUTH_URL,
                            external_token_url= TOKEN_URL,
                            client_id= CLIENT_ID,
                            with_pkce=True,
                            app_url= "http://127.0.0.1:8050",
                            redirect_suffix = "/redirect",
                            auth_suffix = "/",
                            home_suffix="/app",
                            client_secret= CLIENT_SECRET,
                            _secret_key= None,
                            auth_request_headers= None,
                            token_request_headers= None,
                            scope= ("openid profile"),
                            )
    

    Could the error be caused by anything other than an incorrect token field name?

    I also am getting this error if I try to go to /redirect after already authenticating, I am not sure if it is relevant or normal behavior after authentication.

    File "/dash_auth_external/routes.py", line 76, in build_token_body
    code = redirect_params["code"][0]
    KeyError: 'code'
    
    opened by John-LucaGIT 1
  • routes: do not override response headers

    routes: do not override response headers

    Response headers in dash-2.4 is not a dictionary but Headers. It also not ideal to override the member but amend values.

    File "/home/alonbl/.local/lib/python3.10/site-packages/flask/app.py", line 1889, in process_response response = self.ensure_sync(func)(response) File "/home/alonbl/.local/lib/python3.10/site-packages/dash/dash.py", line 1820, in _after_request response.headers.add("Server-Timing", value) AttributeError: 'dict' object has no attribute 'add'

    Signed-off-by: Alon Bar-Lev [email protected]

    opened by alonbl 0
Releases(v0.2.4)
Owner
James Holcombe
Data Science Apprentice
James Holcombe
Plotly Dash plugin to allow authentication through 3rd party OAuth providers.

dash-auth-external Integrate your dashboards with 3rd parties and external OAuth providers. Overview Do you want to build a Plotly Dash app which pull

James Holcombe 15 Dec 11, 2022
Generate payloads that force authentication against an attacker machine

Hashgrab Generates scf, url & lnk payloads to put onto a smb share. These force authentication to an attacker machine in order to grab hashes (for exa

xct 35 Dec 20, 2022
Strong, Simple, and Precise security for Flask APIs (using jwt)

flask-praetorian Strong, Simple, and Precise security for Flask APIs API security should be strong, simple, and precise like a Roman Legionary. This p

Tucker Beck 321 Dec 18, 2022
Login-python - Login system made in Python, using native libraries

login-python Sistema de login feito 100% em Python, utilizando bibliotecas nativ

Nicholas Gabriel De Matos Leal 2 Jan 28, 2022
OAuthlib support for Python-Requests!

Requests-OAuthlib This project provides first-class OAuth library support for Requests. The OAuth 1 workflow OAuth 1 can seem overly complicated and i

1.6k Dec 28, 2022
A JSON Web Token authentication plugin for the Django REST Framework.

Simple JWT Abstract Simple JWT is a JSON Web Token authentication plugin for the Django REST Framework. For full documentation, visit django-rest-fram

Jazzband 3.2k Dec 28, 2022
Django Rest Framework App wih JWT Authentication and other DRF stuff

Django Queries App with JWT authentication, Class Based Views, Serializers, Swagger UI, CI/CD and other cool DRF stuff API Documentaion /swagger - Swa

Rafael Salimov 4 Jan 29, 2022
User-related REST API based on the awesome Django REST Framework

Django REST Registration User registration REST API, based on Django REST Framework. Documentation Full documentation for the project is available at

Andrzej Pragacz 399 Jan 03, 2023
Simplifying third-party authentication for web applications.

Velruse is a set of authentication routines that provide a unified way to have a website user authenticate to a variety of different identity provider

Ben Bangert 253 Nov 14, 2022
Basic auth for Django.

easy-basicauth WARNING! THIS LIBRARY IS IN PROGRESS! ANYTHING CAN CHANGE AT ANY MOMENT WITHOUT ANY NOTICE! Installation pip install easy-basicauth Usa

bichanna 2 Mar 25, 2022
Login qr line & qr image

login-qr-line-qr-image login qr line & qr image python3 & linux ubuntu api source: https://github.com/hert0t/BEAPI-BETA import httpx import qrcode fro

Alif Budiman 1 Dec 27, 2021
Simple Login - Login Extension for Flask - maintainer @cuducos

Login Extension for Flask The simplest way to add login to flask! Top Contributors Add yourself, send a PR! How it works First install it from PyPI. p

Flask Extensions 181 Jan 01, 2023
Flask user session management.

Flask-Login Flask-Login provides user session management for Flask. It handles the common tasks of logging in, logging out, and remembering your users

Max Countryman 3.2k Dec 28, 2022
Easy and secure implementation of Azure AD for your FastAPI APIs 🔒 Single- and multi-tenant support.

Easy and secure implementation of Azure AD for your FastAPI APIs 🔒 Single- and multi-tenant support.

Intility 220 Jan 05, 2023
A Python tool to generate and refresh Amazon access tokens.

amazon_auth A Python tool to generate and refresh Amazon access tokens. Description This tool generates and outputs Amazon access and refresh tokens f

15 Nov 21, 2022
This Python based program checks your CC Stripe Auth 1$ Based Checker

CC-Checker This Python based program checks your CC Stripe Auth 1$ Based Checker About Author Coded by xBlackx Reach Me On Telegram @xBlackx_Coder jOI

xBlackxCoder 11 Nov 20, 2022
Awesome Django authorization, without the database

rules rules is a tiny but powerful app providing object-level permissions to Django, without requiring a database. At its core, it is a generic framew

1.6k Dec 30, 2022
Use this to create (admin) personal access token in gitlab database. Mainly used for automation.

gitlab-personal-access-token Ensure PAT is present in gitlab database. This tool is mainly used when you need to automate gitlab installation and conf

CINAQ Internet Technologies 1 Jan 30, 2022
JSON Web Token implementation in Python

PyJWT A Python implementation of RFC 7519. Original implementation was written by @progrium. Sponsor If you want to quickly add secure token-based aut

José Padilla 4.5k Jan 09, 2023
it's a Django application to register and authenticate users using phone number.

django-phone-auth It's a Django application to register and authenticate users using phone number. CustomUser model created using AbstractUser class.

MsudD 4 Nov 29, 2022