Created
January 25, 2016 14:51
-
-
Save eugeniop/fd2bc2a78b490b711565 to your computer and use it in GitHub Desktop.
A proof of concept for SCIM -> Auth0 proxy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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