I couldn't figure out why my flash message wasn't available when testing a bad password login. Finally I figured it out; flash doesn't work with Axios.
Why is it that flash-connect
doesn't work with Axios but it works with Postman? I'm a noob with sessions, so I think it may have something to do with sessions.
I used Node.js, Express.js, Passport.js
Here is the gist.
How to recreate using the gist:
- Save each file in a project folder
npm install
npm start
You'll see axios log to the console: "Error from Flash Message: undefined". The flash message is missing.
If you use Postman and post to http://localhost:3300/login
with the body { "email":"test@test.com", "password": "paskword" }
you get the correct flash message: Error from Flash Message: invalid password.