Skip to main content

Flask extension for OpenID Connect authentication.

Project description

Flask-pyoidc

PyPI codecov.io Build Status

This Flask extension provides simple OpenID Connect authentication, backed by pyoidc.

"Authorization Code Flow", "Implicit Flow", "Hybrid Flow", "Client Credentials Flow" are supported.

Getting started

Read the documentation or have a look at the example Flask app for a full example of how to use this extension.

Below is a basic example of how to get started:

app = Flask(__name__)
app.config.update(
    OIDC_REDIRECT_URI = 'https://example.com/redirect_uri',
    SECRET_KEY = ...
)

# Static Client Registration
client_metadata = ClientMetadata(
    client_id='client1',
    client_secret='secret1',
    post_logout_redirect_uris=['https://example.com/logout'])


provider_config = ProviderConfiguration(issuer='<issuer URL of provider>',
                                        client_metadata=client_metadata)

auth = OIDCAuthentication({'default': provider_config}, app)

@app.route('/')
@auth.oidc_auth('default') # endpoint will require login
def index():
    user_session = UserSession(flask.session)
    return jsonify(access_token=user_session.access_token,
                   id_token=user_session.id_token,
                   userinfo=user_session.userinfo)

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

Flask-pyoidc-3.14.3.tar.gz (31.1 kB view details)

Uploaded Source

Built Distribution

Flask_pyoidc-3.14.3-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file Flask-pyoidc-3.14.3.tar.gz.

File metadata

  • Download URL: Flask-pyoidc-3.14.3.tar.gz
  • Upload date:
  • Size: 31.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for Flask-pyoidc-3.14.3.tar.gz
Algorithm Hash digest
SHA256 4a42589f76733c3968ac5f99595c1525a682754916c34f7c029acee6c8ce3bb7
MD5 73cbbb4fa7aaf6d382ed1dc8d1bbd7d0
BLAKE2b-256 100beafc37666076dd31f9ef6de174c2b31bf2315ca73872fdc6bde61b75555d

See more details on using hashes here.

File details

Details for the file Flask_pyoidc-3.14.3-py3-none-any.whl.

File metadata

File hashes

Hashes for Flask_pyoidc-3.14.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a29b7c7660aed9e7b602bfe3cf1d2e5b4e5bc52448cb58babffe2ed10a74cac5
MD5 091f862c814b552eada4512ba9e429f9
BLAKE2b-256 2eb00bee9c23c23fcc33cb248a7629524bdf0d4d04928908adc825a0aff486d7

See more details on using hashes here.

Supported by

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