Skip to main content

a Flask wrapper which handles OIDC authentication, authorization, and the OAuth flow for a given Identity Provider.

Project description

Easy OIDC Flow

This python library is designed to be an easy drop in which handles OIDC authentication, authorization, and the OAuth flow.

Example Implementation

from flask import Flask, request
from easy_oidc_flow import EasyOIDCFlow

app = EasyOIDCFlow(Flask(__name__))

@app.route("/")
def main():
  return f"hello {request.user_data["email"]}!"

if __name__ in "__main__":
  app.run(host="0.0.0.0", port=8000, debug=True)

Quickstart

Create a .env file using the .env.template file as a template. Populate with your OAuth Client details (see below)

Run the example server implementation with the following:

uv run --env-file=.env .\example_server.py

IDP Configuration

Google Cloud Platform

  1. Create a GCP Project
  2. Navigate to https://console.cloud.google.com/auth/clients/
  3. Create a Web Application OAuth Client ID
  4. Download the OAuth client id .json file
  5. Copy .env to .env.template and fill out the client id and client secret from the downloaded OAuth .json file
  6. Delete the .json file from your system

Google Cloud Platform Identity Platform Client ID creation

Additional Details

This Flask context wrapper overrides the following REST routes: /login /callback

So make sure that your flask app doesn't define these routes, or an error will be thrown.

References

https://developers.google.com/identity/openid-connect/openid-connect#discovery

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easy_oidc_flow-1.0.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easy_oidc_flow-1.0.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file easy_oidc_flow-1.0.0.tar.gz.

File metadata

  • Download URL: easy_oidc_flow-1.0.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.27

File hashes

Hashes for easy_oidc_flow-1.0.0.tar.gz
Algorithm Hash digest
SHA256 05035f5e3017b49af39200bd1e5566a30d460010d5ec5ad1c8150a34130f60ba
MD5 10ee91137199d235b82e4b89c7c3f006
BLAKE2b-256 e066afc820a96ea723f4362284a564ecf17ab41d4b7b79e40b7069963990a231

See more details on using hashes here.

File details

Details for the file easy_oidc_flow-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for easy_oidc_flow-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f42048c1a663438ed0efab00984210c3df143faeadd714ae8447de205f1efb6
MD5 9f013821b7ef0e79d6f2b97705075e33
BLAKE2b-256 60e46cb1d4b0afb35b1fb2fcfa21c72ed1d6d113c0a4065a622b66f766246954

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page