-
Run the following command
node index.js
-
Do a login
curl -s -b node_modules/delete-this.tmp -c node_modules/delete-this.tmp -X POST "http://localhost:3000/auth/login" -H "Content-Type: application/json" -d '{"email": "abc@example.com", "password": "123456789"}' --retry 0 --connect-timeout 30
-
Retrieve a session
curl -s -b node_modules/delete-this.tmp -c node_modules/delete-this.tmp -X GET "http://localhost:3000/auth/session" --retry 0 --connect-timeout 30
- When you run the app
- Go to http://localhost:3000 and click on Get Session. It should return false if there is no session
- You click Login + Remember Me
- It logs you in and assigns a rememberMe cookie
- You close the browser
- Open the browser again and navigate to http://localhost:3000
- You click Get Session and it should return the logged in user
-
You click Login + Remember Me
-
It throws the error below in the backend
TypeError: Cannot set properties of undefined (setting 'user') at /Users/vr/cookie-session-ws-test/node_modules/passport-remember-me/node_modules/passport/lib/passport/http/request.js:45:35 at pass (/Users/vr/cookie-session-ws-test/node_modules/passport/lib/authenticator.js:292:43) at serialized (/Users/vr/cookie-session-ws-test/node_modules/passport/lib/authenticator.js:301:7) at file:///Users/vr/cookie-session-ws-test/index.js:36:3 at pass (/Users/vr/cookie-session-ws-test/node_modules/passport/lib/authenticator.js:309:9) at Authenticator.serializeUser (/Users/vr/cookie-session-ws-test/node_modules/passport/lib/authenticator.js:314:5) at req.login.req.logIn (/Users/vr/cookie-session-ws-test/node_modules/passport-remember-me/node_modules/passport/lib/passport/http/request.js:43:29) at file:///Users/vr/cookie-session-ws-test/index.js:160:9 at strategy.success (/Users/vr/cookie-session-ws-test/node_modules/passport/lib/middleware/authenticate.js:222:18) at verified (/Users/vr/cookie-session-ws-test/node_modules/passport-local/lib/strategy.js:83:10)