Module 74: Authentication and Authorisation

Lesson 3 of 5 · 15–25 minutes

Sessions and tokens

🏠The everyday picture

After the guard checks your ID, you get a visitor badge for the day. Anyone holding the badge looks like you, so badges must be hard to copy, expire at the end of the day, and be taken back when you leave.

📘What it really is

🖱️Try it

In your browser's developer tools (Application → Cookies), inspect your CRM's session cookie and confirm HttpOnly, Secure and SameSite. Log in, copy the cookie value, log out, and try the old value with curl against an authenticated endpoint: it must be rejected. Change your password and check that other sessions are logged out.

✅Quick check

Why should session cookies be HttpOnly?

Show the answer

So JavaScript (including injected scripts) can't read and steal them.

Why are JWTs hard to revoke?

Show the answer

The server accepts any validly signed token until it expires, without checking a list; so they must be short-lived.

← PreviousPasswords and MFA
ProLearners Assist