Skip to content

Instantly share code, notes, and snippets.

@fsargent
Last active March 11, 2019 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fsargent/26159f93a5b6d4514fff40e9be36e2ae to your computer and use it in GitHub Desktop.
Save fsargent/26159f93a5b6d4514fff40e9be36e2ae to your computer and use it in GitHub Desktop.
const app = new (require('express'))();
const wt = require('webtask-tools');
const crypto = require('crypto');
// Be sure to specify your SDK key for your environment!
app.get('/', (req, res) => {
const hmac = crypto.createHmac('sha256', req.webtaskContext.secrets.LD_SDK_KEY);
hmac.update(req.user.email);
req.user.ld_hash = hmac.digest('hex');
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(req.user));
});
module.exports = wt.fromExpress(app).auth0()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment