Cookie-Based Authentication
Cookies based Authentication works normally in these 4 steps-
- The user provides a username and password in the login form and clicks Log In.
- After the request is made, the server validate the user on the backend by querying in the database. If the request is valid, it will create a session by using the user information fetched from the database and store them, for each session a unique id called session Id is created ,by default session Id is will be given to client through the Browser.
Browser will submit this session Id on each subsequent requests, the session ID is verified against the database, based on this session id website will identify the session belonging to which client and then give access the request.
Once a user logs out of the app, the session is destroyed both client-side and server-side.