Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
create
✓ import { create } from 'volos-oauth-redis';
✗ const create = require('volos-oauth-redis').create;
ESM import since v0.12; CommonJS require also works.
default
✓ import volosOauthRedis from 'volos-oauth-redis';
✗ const volosOauthRedis = require('volos-oauth-redis');
Default export is the create function.
OAuth
✓ import { OAuth } from 'volos-oauth-redis';
✗ const OAuth = require('volos-oauth-redis').OAuth;
OAuth type not exported; use create to instantiate.
Shows how to create an OAuth instance with Redis options and issue a token.
import { create } from 'volos-oauth-redis';
const oauth = create({
host: process.env.REDIS_HOST ?? 'localhost',
port: process.env.REDIS_PORT ?? 6379,
db: 0
});
const client = {
client_id: 'myApp',
client_secret: 'mySecret',
redirect_uris: ['http://localhost:3000/callback'],
scope: 'read'
};
await oauth.setClient(client);
const token = await oauth.issueToken({
client_id: 'myApp',
client_secret: 'mySecret',
grant_type: 'authorization_code',
code: 'someAuthCode',
redirect_uri: 'http://localhost:3000/callback'
});
console.log(token.access_token);
Debug
Known issues
gotchaRedis must be running and accessible at the provided host/port; otherwise create() will hang.fixEnsure Redis server is available before calling create().
affects: >=0.10.0
deprecatedThe client_id and client_secret are stored in plaintext in Redis.fixConsider using encryption or a more secure OAuth library.
affects: >=0.10.0
gotchaAll keys in Redis are prefixed with 'volos:' and stored in database 0 by default; changing db may cause conflicts.fixSpecify a distinct db for each application if using multiple libraries.
affects: >=0.10.0
gotchaThe package uses a very old version of the 'redis' dependency (ca. 2012) which may have security issues.fixUpdate package or manually override redis dependency.
affects: >=0.10.0 <0.14.0
gotchaNo built-in token expiration or cleanup; tokens persist indefinitely unless manually deleted.fixImplement TTL using Redis expiration or schedule cleanup jobs.
affects: >=0.10.0
Errors
Common errors & fixes
Error: Redis connection to localhost:6379 failed - connect ECONNREFUSED
Redis server not running on the specified host/port.
fixStart Redis server or change host/port in options.
TypeError: oauth.setClient is not a function
Using default import incorrectly; create returns an OAuth object, but setClient may not exist if using an older version.
fixEnsure you are using the correct version (0.12+) and importing create properly.
Error: Can't set headers after they are sent.
Middleware misconfiguration; the OAuth object's methods (e.g., verifyToken) may be called multiple times in the same request pipeline.
fixEnsure callback is called only once per request.
Audit
Dependencies
redisrequiredRedis client for connecting to Redis data store