Skip to main content

Flask-GoogleAuth

This is a partial port of torando.auth to be used with Flask.

It is small, self contained and do not use any filesystem operations. Greate for internal apps.

Written by Alexander Saltanov, inspired by Kenneth Reitz.

Usage

Example usage for Google Federated Login.

Routes /login/ and /logout/ will be provided automagically.

Require an account from a given Google Apps domain for your Flask apps:

from flask import Flask, g
from flask_googleauth import GoogleFederated

# Setup Flask
app = Flask(__name__)
app.secret_key = "random secret key"

# Setup Google Federated Auth
auth = GoogleFederated("mokote.com", app)

@app.route("/")
@auth.required
def secret():
    # Once user is authenticated, his name and email are accessible as
    # g.user.name and g.user.email.
    return "You have rights to be here, %s (%s)" % (g.user.name, g.user.email)

app.run()

If you want to authenticate your users with general Google OpenID you should import and use GoogleAuth instead of GoogleFederated:

auth = GoogleAuth(app)

You can force all requests to be authenticated by setting force_auth_on_every_request on the auth object:

auth.force_auth_on_every_request = True

Install

To install Flask-GoogleAuth:

pip install flask-googleauth

Prerequisites

Be sure that your Google Apps domain is enabled to be an OpenID provider under “Advanced tools” → “Federated Login using OpenID”.

Metadata

Release files for Flask-GoogleAuth 0.4.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 Flask-GoogleAuth 0.4.2
File Size Uploaded Provenance Actions
Flask-GoogleAuth-0.4.2.tar.gz 5.5 kB Without provenance Details for Flask-GoogleAuth-0.4.2.tar.gz

Release files / Flask-GoogleAuth-0.4.2.tar.gz

Download URL Flask-GoogleAuth-0.4.2.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c4aa0e73e05bfa4e5d8251f0bd2876c1a2a05672dadcd5f43e25606cb658adfb
BLAKE2b-256 checksum
How to use checksums
38b82b3c510a3a4cce9af59552158c36eb86302f7aab9714ea708431826ef6c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for Flask-GoogleAuth 0.4.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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