Created
October 20, 2017 10:27
-
-
Save BrunoBernardino/916535912897f5f096f70d5c53095de2 to your computer and use it in GitHub Desktop.
Webtask for oauth2-test.
This file contains hidden or 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
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