/redis-token-rotation

Refresh tokens on Redis

Primary LanguagePythonMIT LicenseMIT

TokenCycle

Custom token lifecyle and rotation in Redis

License Version

PRs Welcome

About

Made for authorization flows that use internal refresh tokens. Implements token generation, validation, rotation and token reuse detection, using an async Redis client.

Installation

Clone the repository and install the package:

$ git clone https://github.com/iivek/redis-token-rotation.git
$ pip install -e ./

Usage

First, let's provision a local redis instance, using terraform. From project root:

$ export PROJECT_ROOT=$(pwd)
$ cd $PROJECT_ROOT/examples/terraform && \
  terraform init && \
  terraform plan && \
  terraform apply -auto-approve              # provision a local redis instance

Next, we can run the example python script:

$ cd $PROJECT_ROOT/examples && \
  PYTHONPATH=$PROJECT_ROOT python main.py    # run the example