Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oauth not responding #70

Open
ChicoFigueiredo opened this issue Jun 24, 2018 · 4 comments
Open

oauth not responding #70

ChicoFigueiredo opened this issue Jun 24, 2018 · 4 comments

Comments

@ChicoFigueiredo
Copy link

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

@nguyentuandat
Copy link

The same issue for me.
ExpressOAuthServer.prototype.token
Does not work.

@moacode
Copy link

moacode commented Aug 13, 2018

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.

@mjsalinger
Copy link
Contributor

@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?

@moacode
Copy link

moacode commented Aug 14, 2018

@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.

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

No branches or pull requests

4 participants