Explain the flow of using cookies
Answer
- User enters credentials
- The server verifies the credentials -> a sessions is created and stored in the database
- A cookie with the session ID is set in the browser of that user
- On every request, the session ID is verified against the database
- The session is destroyed (both on client-side and server-side) when the user logs out