Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

response object in swagger security #214

Closed
rguikers opened this issue May 13, 2015 · 1 comment
Closed

response object in swagger security #214

rguikers opened this issue May 13, 2015 · 1 comment

Comments

@rguikers
Copy link

I'm trying to implement an oAuth2 handler in swagger security middleware with passport.
Expected behavior will be that oAuth handles the error when token is invalid. For this we will need response object in the handler..
prefered handler :

oauth2: function(req, def, scopes, callback) {
  return passport.authenticate('bearer', { session: false })(req, **res**, callback);
}

Missing response for this to work...

Keep in mind that i'm a beginner in swagger security, so maybe i'm missing some valuable insight on why the response object is not included..

Thanks for your help

@whitlockjc
Copy link
Member

This is a duplicate of #203. I'll get it sorted, although I think you can still use the Passport API without the res object. Based on the documentation here, it seems the res is only used in your handler and not the Passport API:

app.get('/api/me',
  // This does not seem to use the `res` object
  passport.authenticate('bearer', { session: false }),
  // This is your actual 'handler' and of course it needs the `res` object
  function(req, res) {
    res.json(req.user);
  });

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants