Skip to content

Instantly share code, notes, and snippets.

@BrentAureli
Created April 30, 2015 14:04
Show Gist options
  • Save BrentAureli/69041f1974043ba20fee to your computer and use it in GitHub Desktop.
Save BrentAureli/69041f1974043ba20fee to your computer and use it in GitHub Desktop.
router.get('/testAPI', function(req, res, next){
//if there is a access token, proceed with bearer auth
if(req.query.access_token) next();
//skips this router stack
else next('route');
}, passport.authenticate('bearer', { session: false }),
function(req, res, next){
res.json({ SecretData: 'abc123', Authenticated: true })
});
router.get('/testAPI', function(req, res){
res.json({ SecretData: 'abc123', Authenticated: false });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment