Skip to main content

Useful tools to work with OIDC in Python and Flask

Project description

SM Flask OIDC

This can be helpfull if you want to implement IdentityServer4 OIDC in Flask Python application

How to use:

Install: python -m pip install sm-flask-oidc Upgrade: python -m pip install sm-flask-oidc --upgrade

Import: from sm_flask_oidc import sm_flask_oidc_helper

Define Params: CLIENT_ID = '' CLIENT_SECRET = '' APP_URI = '' AUTH_API_ROUTE = '' AUTH_STATE = ''

Activate Flask Session: app.secret_key = "my-super-secret" Create instance: sm_oidc = sm_flask_oidc_helper.SmFlaskOidcHelper(CLIENT_ID, CLIENT_SECRET, APP_URI, AUTH_API_ROUTE, AUTH_STATE)

Define Required Routes:

@app.route("/login")
def login():
    return sm_oidc.login()

@app.route("/login-callback")
def login_callback():
    return sm_oidc.login_callback()

@app.route("/logout")
def logout():
    return sm_oidc.logout()

@app.route("/logout-callback")
def logout_callback():
    return sm_oidc.logout_callback()

Notes:

After login the following keys will be added to flask.session: id_token, name, email, is_authorized

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

sm-flask-oidc-1.0.8.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

sm_flask_oidc-1.0.8-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file sm-flask-oidc-1.0.8.tar.gz.

File metadata

  • Download URL: sm-flask-oidc-1.0.8.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.0

File hashes

Hashes for sm-flask-oidc-1.0.8.tar.gz
Algorithm Hash digest
SHA256 fa91247c1fe648e1e5536da4ce91125701fc2f101ccdbc03fe0f9cff2d3a9893
MD5 def4a3d454a113189b71ca14132ed918
BLAKE2b-256 effef0c2114bea84f789aabb9c8bc8ee1ed09d2b2dd5eb9d0b38fa757e5b3a86

See more details on using hashes here.

File details

Details for the file sm_flask_oidc-1.0.8-py3-none-any.whl.

File metadata

  • Download URL: sm_flask_oidc-1.0.8-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.8.0 tqdm/4.37.0 CPython/3.7.0

File hashes

Hashes for sm_flask_oidc-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 52494e3b8d385f88b02c0a552a61dd38d5cb790a477c6a3db4e03725888c11a4
MD5 11effa2f3c60c36bcdede6fc2c042c7b
BLAKE2b-256 57a38b50b2221cccd18cf6f746cb86af0d9815ef7be7c747174df3ee4bb21b3a

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