Socket
Book a DemoInstallSign in
Socket

dash-google-oauth

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dash-google-oauth

Authenticate to Dash app using Google OAuth

pipPyPI
Version
1.2
Maintainers
1

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

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts