开发者社区> 镜像站> NPM> consulate-authcode-simple-secrets
consulate-authcode-simple-secrets
simple-secrets authcode plugin for consulate
Last updated 6 years ago by camshaft .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install consulate-authcode-simple-secrets 
SYNC missed versions from official npm registry.

consulate-authcode-simple-secrets Build Status

simple-secrets authcode plugin for consulate

Usage

Just register consulate-authcode-simple-secrets as a plugin with your consulate server:

var consulate = require('consulate')
  , authcode = require('consulate-authcode-simple-secrets');

var app = consulate();

// Give a few db methods
var db = {
  // Save a simple flag to the db that the code hasn't been used
  save: function (code, done) {
    // do db work here
    done(err);
  },
  // Validate the code exists and has not been used
  validate: function (code, done) {
    // do db work here
    done(err, isValid);
  },
  // Invalidate a code so it cannot be used again
  invalidate: function (code, done) {
    // do db work here
    done(err);
  }
};

app.plugin(authcode({
  key: '3b6006d164bae955136a5befea9d0e4a50c22a2f7be5d65c2fd67752625deee3'
}, db));

NOTE It is also recommended that an expiration of about 10 minutes be set on valid authorization codes

Tests

$ npm test

Current Tags

  • 0.1.1                                ...           latest (6 years ago)

2 Versions

  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (2)
Dependents (0)
None