Join our Newsletter — 33% off our NHI Course
Home› Guides› How Logging In Works for Beginners: What happens…
Guide Non-Human Identity (NHI)

How Logging In Works for Beginners: What happens behind the sign-in box, from password check to session

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 1 December 2026 10 min read
On this page

Logging in is how a website checks who you are, then remembers you while you use it.

This guide is for anyone who types a password into a website and wonders what happens next. You do not need technical skills. It follows one sign-in from the password box to the moment you log out.

In short

  • When you sign in, the site checks your password against a scrambled copy it stored earlier.
  • A second check, such as a code or phone prompt, makes a stolen password much less useful.
  • After you sign in, the site gives your browser a session cookie. That cookie keeps you signed in.
  • Whoever holds that cookie can act as you, so logging out and session time limits matter.

What you will learn

  • Follow the steps of a sign-in, from password to session.
  • Explain why sites store a scrambled copy of your password.
  • Describe what a session cookie does and why it is valuable.
  • Know why logging out properly matters.
Proving who you are (authentication)
the check a site does before letting you in.
Your visit (session)
the stretch of time the site treats you as signed in.
Pass in your browser (session cookie)
a small note the site leaves so it remembers you.

What is logging in?

Think of a theme park. At the gate, staff check your ticket and ID. Then they give you a wristband. For the rest of the day you show the wristband, not your ticket.

Signing in to a website works the same way. First the site checks your proof, such as a password. Official US guidance calls this authentication: checking the things you use to claim an identity [1]. Then it gives your browser a cookie holding a session ID, which acts as the wristband [3].

Where the comparison stops working: staff can see that a wristband is on your wrist. A website cannot. Anyone who copies your session cookie can look just like you to the site.

This page is about people signing in. Software, such as scripts and AI agents, proves who it is in other ways. Those are called non-human identities, and they usually use keys or tokens instead of a sign-in box.

Why does it matter?

Almost every online account starts with this process. Knowing the steps shows where things can go wrong.

If you use online accounts

What could happen: someone steals your password and signs in as you.

Check this: turn on a second sign-in check for important accounts.

Next: Password Security for Beginners

If you use shared computers

What could happen: you close the tab but stay signed in, and the next person gets your account.

Check this: always log out on shared devices.

Next: Session Timeouts for Beginners

If you are new to security work

What could happen: a stolen session cookie lets an attacker skip the password and second check.

Check this: learn how sessions are protected, not just passwords.

Next: Session Tokens and Cookies for Beginners

What does it look like?

Here is a made-up version of the note a website sends back after you sign in.

Example only. All values are made up.

HTTP/1.1 200 OK                                  (1)
Set-Cookie: session=EXAMPLE0000; Secure; HttpOnly  (2)
Session timeout: idle 00 min, max 00 h (FAKE)    (3)
Signed in as: [email protected]                 (4)
  1. The site's reply saying the sign-in worked.
  2. In a real file, this line would contain a long random session ID. Secure means it only travels over HTTPS, and HttpOnly means page scripts cannot read it.
  3. Time limits after which the site makes you sign in again.
  4. The account this session belongs to.

Why this is risky: anyone who copies that session value can act as you until it expires.

The safer way: sites should protect the cookie and end sessions on logout. You should log out on shared devices.

How does it work?

  1. You type your username and password. The browser sends them over an encrypted HTTPS connection.
  2. The site checks the password. It does not keep your password as plain text. NIST says passwords must be stored salted and hashed, a one-way scrambling [1]. The site scrambles what you typed and compares the results.
  3. A second check may follow. With MFA, you prove a second factor, such as a code or a phone prompt [1].
  4. The site starts a session. It sends a cookie holding a session ID [3]. A good site creates a fresh session ID at this point [2].
  5. Your browser shows the cookie each time. Every page you open sends it back, so you stay signed in.
  6. The session ends. You log out, or a time limit runs out. On logout, the site should end the session on its own servers too [2].
Diagram titled What happens when you sign in. Five boxes in a row joined by arrows. Password: you type it and it travels over HTTPS. Check: the site compares a scrambled copy. Second check: a code or phone prompt. Session cookie, highlighted: the site gives your browser a pass. Log out: the site ends the session on its servers. Notes underneath say the session cookie works like a wristband, so whoever holds it can act as you, and that time limits end idle sessions.
Figure 1. A sign-in checks your proof once, then a session cookie keeps you signed in until logout or a time limit.

Why does the cookie matter so much? OWASP notes that once you are signed in, the session ID is temporarily as powerful as the strongest sign-in method the site uses [2]. So sites set time limits. OWASP advises both an idle limit and a total limit [2]. For example, NIST allows no more than one hour of inactivity at its middle assurance level [1].

A worked example

This story is made up to show the idea.

Darius Haddad checks his bank account on a library computer. He types his password, then approves a prompt on his phone. The bank's site lets him in.

Behind the scenes, the site compared a scrambled version of his password with the one it stored. Then it checked his phone prompt. Finally, it sent the library browser a session cookie.

Darius finishes and closes the browser tab. He does not press "Log out". He walks away.

The next person opens the browser again. The bank's page loads, and Darius is still signed in. The cookie was still valid. Luckily, the session was only a few minutes old when a librarian noticed and closed the browser.

Later Darius reads about sessions. He learns that the password and phone prompt only protected the front gate. After that, the cookie did all the work.

He changes his habits. On shared computers he always presses "Log out", which tells the bank to end the session on its side. At home, he checks the bank's list of signed-in devices once a month.

Darius learned that signing in is two steps: proving who you are, then holding a pass. Both need care.

Myths and mistakes

What people thinkWhat is true
The website keeps a copy of my password.A well-built site keeps only a salted, hashed version [1], so it can check a password without storing it in plain form.
Closing the tab logs me out.The session cookie may still be valid. Press "Log out" so the site ends the session [2].
Once I pass MFA, I am safe.MFA protects the sign-in. A stolen session cookie can still be used until the session ends.
Sites check my password on every page.Usually they check once, then rely on the session cookie [3].
Software signs in the same way people do.Scripts and AI agents are non-human identities. They usually prove who they are with keys or tokens, not a sign-in box.

What can I do this week?

  • Turn on a second sign-in check for your email and bank.
  • Log out of accounts on any shared computer you use.
  • Look at the list of signed-in devices for one important account, and remove ones you do not know.
  • Use a password manager so each site has a different password.

Checklist

  • I can describe the steps of a sign-in, from password to session.
  • I know sites should store only a scrambled copy of my password.
  • I use a second sign-in check on important accounts.
  • I know a session cookie keeps me signed in, and that it is valuable.
  • I press "Log out" on shared devices instead of closing the tab.
  • I check signed-in devices on my key accounts now and then.
  • I know software and AI agents prove who they are in different ways.

Common questions

What happens when I click "Sign in"?

The site checks your password against a scrambled copy it stored. If you use MFA, it asks for a second proof. Then it sends your browser a session cookie, which keeps you signed in as you move between pages.

What is a session cookie?

It is a small piece of data the site stores in your browser after you sign in. It holds a session ID. Your browser sends it with each request, so the site knows it is still you without asking for your password again.

Why do sites sign me out after a while?

Time limits reduce the damage if someone gets hold of your session. OWASP advises an idle limit and a total limit on every session. When a limit runs out, you simply sign in again, and any copied cookie stops working.

Does logging out really matter?

Yes. Logging out should tell the site to end the session on its servers. Just closing the tab may leave the session cookie working, which matters most on shared or public computers.

Do apps and AI agents log in too?

They prove who they are, but not with a sign-in box. Software such as scripts, services and AI agents are non-human identities. They usually use keys, tokens or certificates, which need their own care.

Where next?

Ready for the detail? Read the practitioner guide: NHI Authentication Guide. It explains how software and AI agents prove who they are, which differs from the human sign-in described here.

Also useful:

Related NHI Mgmt Group resources: How Single Sign On Works, MFA Guide and Authentication Guide.

Key terms

Authentication
Checking that someone is who they claim to be before giving access.
Password hash
A one-way scrambled form of a password that a site stores instead of the password itself.
MFA
Multi-factor authentication: signing in with two or more kinds of proof, such as a password and a phone prompt.
A small piece of data a site stores in your browser to remember that you are signed in.
Session timeout
A time limit after which a site ends your session and asks you to sign in again.
Non-human identity (NHI)
An identity used by software, such as a script, service or AI agent, rather than a person.

Sources and further reading

  1. NIST, SP 800-63B-4 "Digital Identity Guidelines: Authentication and Authenticator Management", 2025. https://pages.nist.gov/800-63-4/sp800-63b.html (accessed 30 Nov 2026).
  2. OWASP Cheat Sheet Series, "Session Management Cheat Sheet". https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html (accessed 30 Nov 2026).
  3. MDN Web Docs, Mozilla, "Using HTTP cookies". https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Cookies (accessed 30 Nov 2026).

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.