Skip to content

Instantly share code, notes, and snippets.

@eugeniop
Created January 25, 2016 14:51
Show Gist options
  • Save eugeniop/fd2bc2a78b490b711565 to your computer and use it in GitHub Desktop.
Save eugeniop/fd2bc2a78b490b711565 to your computer and use it in GitHub Desktop.
A proof of concept for SCIM -> Auth0 proxy.
var Express = require('express');
var Webtask = require('webtask-tools');
var request= require('request');
var app = Express();
app.get('/Users/:id', function (req, res) {
//These 2 params are created with the Webtask as "secrets". AUTH0_DOMAIN is if the form: https://{your account}.auth0.com
//the API V2 Token can be obtained in the API Explorer: https://auth0.com/docs/api/v2
var token = req.webtaskContext.data.API_V2_TOKEN;
var domain = req.webtaskContext.data.AUTH0_DOMAIN;
request.get(domain + '/api/v2/users/' + req.params.id,
{
headers: {
Authorization: 'Bearer ' + token
}
},function(e,s,b){
//TODO: format user object to map to SCIM User schema
res.json(b);
})
});
module.exports = Webtask.fromExpress(app);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment