1.0.0 • Published 9 years ago

sso-discourse v1.0.0

Weekly downloads
26
License
MIT
Repository
github
Last release
9 years ago

Discourse sso

Codeship Status for weo-edu/sso-discourse js-standard-style

Middleware and library for discourse sso;

Installation

$ npm install sso-discourse

API

.sso(secretKey)

Returns a function for signing login info.

var discourseSso = require('discourse-sso');
var sign = discourseSso.sso('fat tio');

// {sso: discourse_reply_payload, sig: discourse_reply_sig}
var signed = sign({
  email: email,
  external_id: external_id
}, {sso: discourse_payload, sig: discourse_sig});

.middleware(secretKey)

Returns middleware for adding a signed payload to the request. Expects the request to have login info at req.user and puts the payload at req.discourse.

var discourse = discourseSso.middleware('fat tio');

app.get('/sso', getUser, discourse, function(req, res) {
  res.send(req.discourse);
});