Thoughts on refresh token/revoke all workflow

This page summarizes the projects mentioned and recommended in the original post on /r/node

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • Redis

    Redis is an in-memory database that persists on disk. The data model is key-value, but many different kind of values are supported: Strings, Lists, Sets, Sorted Sets, Hashes, Streams, HyperLogLogs, Bitmaps.

  • import { ClientOpts, RedisClient } from "redis"; // TODO: When (if ever) redis supports expiration of hash entries we should remove this prefix and use a hash instead. (See https://github.com/redis/redis/issues/167) const KEY_PREFIX = "SESSION_BLACKLIST:"; const redisOptions: ClientOpts = { host: process.env.REDIS_HOST, // password: process.env.REDIS_PASSWORD, port: (process.env.REDIS_PORT && parseInt(process.env.REDIS_PORT)) || 6379, }; class TokenBlacklist { private readonly client: RedisClient; constructor() { this.client = new RedisClient(redisOptions); } public add(sessionId: string, expiresIn: number): Promise { return new Promise((resolve, reject) => { this.client.setex( KEY_PREFIX + sessionId, expiresIn + (2 * 60 * 1000), // Add 2 minute buffer "", (error: Error | null) => { if (error) { return reject(error); } resolve(); } ); }); } public check(sessionId: string): Promise { return new Promise((resolve, reject) => { this.client.exists( KEY_PREFIX + sessionId, (error: Error | null, exists: number) => { if (error) { return reject(error); } return resolve(exists === 1); } ); }); } public close(): Promise { return new Promise((resolve, reject) => { this.client.quit((error: Error | null) => { if (error) { return reject(error); } return resolve(); }); }); } }

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts