Skip to content

Latest commit

 

History

History

redis

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Redis Example

A simple example with support for password and refresh_token grants using Redis. You'll need node-redis installed.

Usage

app.oauth = oauthserver({
  debug: true,
  model: require('./model')
});

Data model

The example makes use of a simple data model where clients, tokens, refresh tokens and users are stored as hashes. The allowed grants for each client are stored in a set clients:{id}:grant_types. This allows grants to be added or removed dynamically. To simplify the user lookup users are identified by their username and not by a separate ID. Passwords are stored in the clear for simplicity, but in practice these should be hashed using a library like bcrypt.

To inject some test data you can run the testData.js script in this directory. This will create a client with the ID client and secret secret and create a single user with the username username and password password.