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"

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: sm-flask-oidc-1.0.7.tar.gz
  • Upload date:
  • Size: 3.2 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.7.tar.gz
Algorithm Hash digest
SHA256 09c0c85b5c7951161a905da73e0a004bc2dc9b4c14af120a53642d6c29e29ee1
MD5 2a74c7f5b4c809225b6f4d388c588703
BLAKE2b-256 b5f9033f29728ac7f6fe86072c245f70cd5c2fd498100a1fdd78af3f7536251b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sm_flask_oidc-1.0.7-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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a753e85ea32ee845dd4ead679363e4e6c788addc8d210f1fa517b625b653415e
MD5 e798661867821151a2c568c2b4844928
BLAKE2b-256 38129353d18ceb6c870d81e0ab6898efe12e111489bb6a97ef91b0a32daa0658

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