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

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

  2. Run the example server implementation with the following:

uv run --env-file=.env .\example_server.py
  1. Navigate to http://localhost:8000/
  2. Follow through the OAuth flow
  3. Congrats! You are now successfully authorized.

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.1.tar.gz (3.4 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.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for easy_oidc_flow-1.0.1.tar.gz
Algorithm Hash digest
SHA256 f7df737f48f112fcc1a9c11201296060302b44bf083ef98fdc6a4813c6536920
MD5 a278f296fd44502366763c3c199eb476
BLAKE2b-256 a6744ac465ef0682ffca4cc4ed3d1079bd4c76336d0ec2363065b44f44f3b8d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for easy_oidc_flow-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bd51c7d3114ed4832fd21bb4c0510807340a118df050963f7aba61cd2bbe3887
MD5 c15e086e9012d364121efb33136d9802
BLAKE2b-256 80506ffc2e6891d4e9aada168a3ed887e4b9336c321fd8b35b23a95772c4263e

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