Last active
October 24, 2017 15:34
-
-
Save glennblock/8c573e53fd40d184ac87a417625605ed to your computer and use it in GitHub Desktop.
zerocrm-compiler.js
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
const Authz = require('auth0-ext-compilers/lib/authorization'); | |
const Factory = require('auth0-ext-compilers/lib/compilers/compilerFactory'); | |
const Generic = require('auth0-ext-compilers').generic; | |
module.exports = Factory.createCompiler(zeroCRMHandler); | |
function zeroCRMHandler(func, ctx, cb) { | |
Authz.is_authorized(ctx, err => { | |
if (err) return cb(err); | |
func.secrets = ctx.secrets; | |
func.meta = ctx.meta; | |
return func(ctx.body, cb); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment