express-oauth-server
express-oauth-server copied to clipboard
oauth not responding
I'm try generate oauth tokens with password grant but the server not responding my branch: https://github.com/ChicoFigueiredo/receita.digital/tree/001-criando-servidor-oauth2/server
Postman : Testes.postman_collection.json.zip
I'm using mongodb
The same issue for me.
ExpressOAuthServer.prototype.token
Does not work.
I just struck this one too. I'm still fairly new to Express, but try adding the oauth.authorize() call as a callback function to your route.
E.g.
app.post('/oauth2/authorize', (req, res, next) => {
// Redirect to the login screen if the user is not authenticated
if( !req.session.user ) {
return res.redirect(`/login?redirect=${req.path}&${querystring.stringify(req.query)}`);
}
next();
}, app.oauth.authorize());
As oauth.authorize()
essentially returns a middleware function, it's run in sequence after I handle whether the user is logged in or not.
@ChicoFigueiredo - The link you supplied is missing.
@nguyentuandat can you supply some code?
@thejoshsmith - have you implemented the various model functions? What is exactly happening when you execute this route?
@mjsalinger yes I implemented the model methods (using redis), however I found when using
return app.oauth.authorize();
in my authorize route, the server would just hang. I didn't spend too much time debugging as what I posted above did the trick.