[Session And Cookies] - How Does User Login Work?

2 days ago | Carrie Brekke PhD

[Session And Cookies] - How Does User Login Work?

Cookies And Session We all use Facebook, Gmail, and Twitter on a daily basis. They all have one thing in common: they all demand you to check in before you can accomplish anything. You can't tweet on Twitter, comment on Facebook, or email on Gmail unless you've signed up for the service and are logged in. So, how does it function? How does the website verify our identity? How does it know who's logged in and where they're logging in from? Let's take a look at each of these questions individually.

How does User Login work?

An online site's server receives your username and password every time you check in. Next, the server verifies your password against the server's password database. A password error message will appear if the two don't match. However, if it matches, you are logged in.

What happens when I get logged in?

When you log in, the web server opens a session and sets a cookie variable in your browser to keep track of your session. As a result, the cookie variable serves as a pointer to the session formed. Confused? Let's keep it simple for now.

How does Session work?

Session and Cookies

An account is created by the server as soon as username and password are entered correctly. To simplify their meaning, I prefer the term "beginning of a relationship" when referring to sessions.

As soon as you enter the correct credentials, the server establishes a connection with you. For this reason, the server places a cookie in our browsers to distinguish our unique relationship with the server from all the others.

What is a Cookie?

When a website sends a cookie to your browser, it stores a small bit of data. You've probably seen them before.

Because the server creates a relationship with you when you log in, it stores the unique session identifier in your browser as a cookie.

What’s the Point?

So that the server knows who made the tweet or comment, all of this is necessary to verify that it's actually your account.

Whenever you check in to the site, a cookie with your session id is created. Anyone who inputs the correct username and password combination is now issued this session id.

So, the session id is given to the account owner. Anyone who visits that website will be identified by their session id.

Keep me logged in?

A time restriction is set for the sessions. It's not like in the real world, when relationships can survive for years without seeing each other. As you complete other tasks, you must continuously informing the server that you are online. You'll be logged out if it doesn't happen.

The Keep Me Logged In function on some websites, however, allows them to store another unique characteristic in our browsers in the form of cookies. In order to automatically log us in, this unique variable is compared against our password. on the server. It's termed cookie stealing when someone steals the unique identifier. As a result, they have access to your personal information and your bank account.

Why and when to use Cookies?

Because http is a stateless protocol, we may track the application's state by using tiny files kept on the user's machine. The browser determines the location of the cookies. As a general rule, Internet Explorer keeps them in a Temporary Internet Files folder. Persuading consumers to choose their own preferences is one way to personalise the user experience. It is possible to customise the pages requested by using cookies. Monitoring the pages a person visits.

Why and when to use Sessions?

Information such as the user id should be stored in an area where harmful individuals cannot access them. Use sessions to pass values between pages.

Useful when you wish to save global variables more efficiently and securely than just passing them in the URL, or when designing an application such as a shopping cart that needs to temporarily store information with a capacity more than 4KB.


Login Systems and how we are authorised on a website were topics of discussion in class. What sessions and cookies are, as well as their implementation in a login method, were also discussed. In the meantime, if you have any questions about User-Login, simply leave a comment and I'll be happy to help you out.

Why is a web session used? (Web session use case examples)

While maintaining user privacy, developers utilise session IDs to save information server-side instead of in-browser to reduce the amount of data stored in the browser. On every action or request, the web application sends the user's session ID and cookie ID back to the server, along with a description of what they did.

Web developers can start creating highly tailored and engaging experiences once they have gathered enough information about how consumers interact with their site. As a result, the firm behind the site (which can convert more visitors into customers, for example) and the user both benefit from such encounters. people that come to see you (they get to the information or products for which they are looking in a fast, hassle-free manner).

Using fast, scalable in-memory processing technologies, web developers cache web session information to ensure that their web sites give a very responsive, personalised experience for many users at the same time.


The Zoom Phishing Scam Aims To Steal Login Credentials

The Zoom Phishing Scam Aims To Steal Login Credentials

During the Covid-19 epidemic, as individuals and organizations become more reliant on video conferencing to keep connected,…

Fix Cash App Login Issues Fastly (2021)

Fix Cash App Login Issues Fastly (2021)

As a safe and rapid money transfer application, Square Cash App is the most popular app in the United States. Using Cash…

Step-by-Step Guide To Log In Axie Infinity On Android

Step-by-Step Guide To Log In Axie Infinity On Android

If you are wanting to log in Axie Infinity on Android, here is the right place for you. How to Register for an Axie Infinity…

The Main Reasons Why You Shouldn't Log In From Public Wi-Fi

The Main Reasons Why You Shouldn't Log In From Public Wi-Fi

Are you considering connecting to an airport, local café, etc., to enjoy the free public Wi-Fi network? In WPA2,…

What To Do If You Can’t Log Into Your Spotify Account?

What To Do If You Can’t Log Into Your Spotify Account?

What to Do if You Can't Log into Your Spotify Account? There are lots of problems for you when Log Into Your Spotify Account,…

Why Are User-Friendly Login Pages Important For Your Website?

Why Are User-Friendly Login Pages Important For Your Website?

This article clarifies why indeed a little module such as your login page can play a really critical part when it comes…