Skip to content

Instantly share code, notes, and snippets.

@BrunoBernardino
Created October 20, 2017 10:27
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 BrunoBernardino/916535912897f5f096f70d5c53095de2 to your computer and use it in GitHub Desktop.
Save BrunoBernardino/916535912897f5f096f70d5c53095de2 to your computer and use it in GitHub Desktop.
Webtask for oauth2-test.
module.exports = function(context, cb) {
if (!context.headers.authorization) {
return cb(403, 'Forbidden');
}
if (context.headers.authorization !== 'Bearer a_token' && context.headers.authorization !== 'Bearer a_new_token') {
return cb(401, 'Unauthorized');
}
cb(null, {
authenticated: true,
user: 'Zapier-OAuth2',
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment