Monday 29 July 2019

could I use cookie-session instead of express-session for passport-auth0?

Sorry this post is related tohttps://www.reddit.com/r/node/comments/cjiokb/auth0passportjs_too_many_redirects_with_more_than/Sorry I am new to this,I am wondering if I can use cookie-session instead of express-session since JWT is supposed to not storing information in server.I am asking because I have read a few tutorial of passport and Auth0, and it also mentioned about expression-session only.I am facing issue with multiple instances + load balancer envrionment where after a user is login at Auth0 login page, and in /callback.router.get('/login', authenticate('auth0', { scope: 'openid email profile' }), (req, res) => res.redirect('/'));router.get('/callback', (req, res, next) => {authenticate('auth0', (authErr, user) => { if (authErr) { console.error(`Error authenticating user: ${authErr}`); return next(authErr); } if (!user) { return res.redirect('/login'); } the user is set to false and eventually I see:[xyzURL] redirected you too many times.Try clearing your cookies.ERR_TOO_MANY_REDIRECTSSince Auth0 is using JWT, could I use cookie-session? if so, what could I do wrong?PS.Here is my session config:const sessionConfig = { name: 'sessionId', domain: 'example.com', secret: uid.sync(18), secure: true, httpOnly: true, maxAge: 1800 * 1000 }; Thank you!Jay

Submitted July 30, 2019 at 05:03AM by ufsi7259

No comments:

Post a Comment