Open yairvillarp opened 8 years ago
I failed to found proper solution, so temporary https://github.com/manjeshpv/node-oauth2-server-implementation/blob/master/components/oauth/authenticate.js#L43
Update 1: Found Solution working with 3.0.0-b2
authenticate().then(token => { req.user = token; next() })
https://github.com/manjeshpv/node-oauth2-server-implementation/blob/67e4e7e601e704a44803245e1a1e3e3255cbc9de/components/oauth/authenticate.js#L29
How about:
app.get('/api/secureSite', app.oauth.authenticate(),
(req, res, next) => {
console.log(res.locals.oauth.token);
next();
},
HERE_YOUR_ACTUAL_MIDELWARE_HANDLER_FOR_THE_ENDPOINT
);
Sorry to ask, but i've been having a problem to finish setup, i had to remove de validation of the response instance in the authenticate() middleware, since i haven't been able to set the response before passing to the middleware.
now another question, how can I get the user that is logged in??