0

session package of npm for implementing authorization and authentication in app.js(nodejs) statement is written like

app.use(cookieSession({
  name: 'wrtpsess',
  keys: ["dsfewfsffe3243efds"],
  // Cookie Options
  maxAge: 24 * 60 * 60 * 1000, // 24 hours
  path: "/panel/writerpanel",
  sameSite:"lax"
}))

in frontend(reactjs) i am setting userid to session on path /panel/writerpanel/loginpage i checked session was available on this path but when i am trying to access session on route /panel/writerpanel/homepage(onreactjs) req.session returns undefined why?? as you can in nodejs file(app.js as given above) path is /panel/writerpanel so both /panel/writerpanel/loginpage and /panel/writerpanel/homepage are the subroute of panel/writerpanel only they must have access to req.session. any help would be appreciated.

0 Answers0