Authenticate to Dash app using Google OAuth
Project description
Dash Google OAuth
This is a simple library using Google OAuth to authenticate and view a Dash app written based on dash-auth. Upon authentication, a cookie is created and kept for 2 weeks.
Setup
Navigate to Google API Console, and setup an OAuth credentials
with http://localhost:5000/login/callback as authorized redirect URL.
Install the package:
$ pip install dash-google-oauth
Define following environment variables:
FLASK_SECRET_KEY
GOOGLE_AUTH_URL
GOOGLE_AUTH_SCOPE
GOOGLE_AUTH_TOKEN_URI
GOOGLE_AUTH_REDIRECT_URI
GOOGLE_AUTH_USER_INFO_URL
GOOGLE_AUTH_CLIENT_ID
GOOGLE_AUTH_CLIENT_SECRET
for example using python-dotenv:
FLASK_SECRET_KEY="..."
GOOGLE_AUTH_URL=https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=consent
GOOGLE_AUTH_SCOPE="openid email profile"
GOOGLE_AUTH_TOKEN_URI=https://oauth2.googleapis.com/token
GOOGLE_AUTH_REDIRECT_URI=http://localhost:5000/login/callback
GOOGLE_AUTH_USER_INFO_URL=https://www.googleapis.com/userinfo/v2/me
GOOGLE_AUTH_CLIENT_ID="..."
GOOGLE_AUTH_CLIENT_SECRET="..."
Add it to the application:
app = Dash(__name__)
from dash_google_oauth.google_auth import GoogleAuth
auth = GoogleAuth(app)
To logout, you may make a GET request to /logout
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 Distribution
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 dash-google-oauth-1.2.tar.gz.
File metadata
- Download URL: dash-google-oauth-1.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1303dceed6d85528b77621932619cfe5d27cd831d94a1475fac77591b521ffcf
|
|
| MD5 |
e18e8fd34cfa6127d2e202dc657e1c0a
|
|
| BLAKE2b-256 |
52a4b6a8a993023a1f6186cd7688054bfc6a45ce605397eb662f40f490e66f07
|
File details
Details for the file dash_google_oauth-1.2-py3-none-any.whl.
File metadata
- Download URL: dash_google_oauth-1.2-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
594f925d78459cfe8af7df96c3b0368c8e834f287581aabfe80e9575f0c87ba9
|
|
| MD5 |
e55c080ad0e2dc287f585eacfb3b5183
|
|
| BLAKE2b-256 |
0f48d2bf8b954a2192003d81e35073397cca5d955e97e405ce0cc92a9360a729
|