Skip to main content

Redis-based session storage for oic library

Project description


This repository contains source code for a Redis-based session storage backend for the oic Python library.


pip install pyoidc-redis-session-backend


A ready-to-run project is located at

Below is an example piece of code that initializes a Redis client which is then used to create an instance of RedisSessionBackend. After that, a Consumer is created which is then configured to use the Redis session backend as its backend.

import redis
from pyoidc_redis_session_backend import RedisSessionBackend
from oic.oic.consumer import Consumer
from oic.utils.authn.client import ClientSecretBasic, ClientSecretPost

redis_client = redis.Redis("localhost", "6379")
# Pass the redis client into the Redis session backend
backend = RedisSessionBackend(redis_client)
# Create an example consumer with example config
consumer = Consumer(backend, {
    "authz_page": "/auth/callback", # Callback URL of your app
    "response_type": "code",
    "client_id": "your_client_id", # Client ID
    "client_authn_method": {
        'client_secret_post': ClientSecretPost,
        'client_secret_basic': ClientSecretBasic
consumer.provider_config("oidc_server_url") # OIDC server URL
consumer.set_client_secret("your_client_secret") # Client secret


To initialize the development environment, run:

  1. Run python3 -m venv env
  2. Run source env/bin/activate
  3. Run pip install -r requirements.txt

Running tests

Run tests with python -m pytest tests/.


Contributions to this repository are welcome.


This project is licensed with MIT license.

Project details

Download files

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

Files for pyoidc-redis-session-backend, version 1.0.3
Filename, size File type Python version Upload date Hashes
Filename, size pyoidc_redis_session_backend-1.0.3-py3-none-any.whl (4.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pyoidc-redis-session-backend-1.0.3.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page