Authentication vs Authorization
+ â
People mix these two up all the time, and honestly itâs easy to see why. They sound similar, they both start with âauthâ, and they both show up the moment you try to use any app. So letâs clear it up.
- Authentication is about proving who you are. Like showing your ID.
- Authorization is about deciding what youâre allowed to do. Like which doors your keycard opens.
Hereâs the simplest way to keep them apart:
- Authentication asks: âAre you really Alex?â
- Authorization asks: âOkay Alex, are you allowed to do this?â
One checks your identity, the other checks your permissions. They happen one after the other, and they are not the same thing. By the end of this lesson youâll never confuse them again, even under interview pressure.
đŻ Why This Matters
This isnât just a definitions question. It shows up in real systems and real interviews:
- Itâs a classic security interview question, and getting the words wrong is an instant red flag. If you say âauthenticationâ when you mean âauthorizationâ, the interviewer notices right away.
- Almost every app youâll ever build needs both. Users have to log in, and then the app has to decide what each user can touch.
- Most real security bugs live in the gap between these two. An app might check who you are but forget to check whether youâre allowed, and thatâs how people end up seeing data that isnât theirs.
So this is a small idea with big consequences. Weâll keep it beginner-correct, plain, and easy to remember.
𪪠Real-World Analogy
Think about going to the airport. Two very different checks happen there, and they map perfectly onto our topic:
- First, at security, someone looks at your ID and your face. Theyâre confirming you are really the person on the ticket. That check is authentication.
- Later, at the gate, the staff scan your boarding pass. Theyâre checking whether youâre allowed onto this specific flight, in this specific seat. That check is authorization.
See the difference? Your ID proves who you are. Your boarding pass decides where youâre allowed to go.
An office works the same way:
- Your ID badge proves youâre an employee. Thatâs authentication, the building knows itâs really you.
- But your badge only opens certain doors. The server room might stay locked for you while it opens for the IT team. Thatâs authorization, deciding which rooms you can enter.
Same badge, two jobs. Hold this picture in your head, because every example below comes back to it.
đ What is Authentication
Authentication is the step where the system makes sure you are who you claim to be. Itâs proving your identity, nothing more.
- The word itself is sometimes shortened to authn in security writing, so donât get thrown off when you see it.
- It always comes first. Before an app can decide what youâre allowed to do, it has to know who you actually are.
- A real-world example is logging into Gmail. You type your email and password, and Gmail checks that they match. That whole âis this really youâ check is authentication.
So how does a system actually verify you? It usually asks for one or more proofs:
- Something you know. A password or a PIN. You prove itâs you because only you should know the secret.
- Something you have. A one-time code, often called an OTP, sent to your phone or generated by an app. (OTP is short for One-Time Password.) You prove itâs you because only you have the phone.
- Something you are. Your fingerprint or your face. This is called biometrics, and you prove itâs you with a part of your body.
When an app asks for two of these together, like a password plus an OTP, thatâs called multi-factor authentication, or MFA. The idea is simple: even if someone steals your password, they still donât have your phone, so they still canât get in.
Why one factor often isn't enough
A password alone can be guessed, leaked, or stolen. Adding a second factor like an OTP or fingerprint means an attacker needs two separate things to break in, which is much harder. Thatâs why banks and email providers push you toward MFA.
đ What is Authorization
Authorization is the step that decides what youâre allowed to do once the system already knows who you are. Itâs about permissions, not identity.
- Itâs sometimes shortened to authz, the partner abbreviation to authn.
- It always comes after authentication. The system first confirms youâre Alex, and only then checks what Alex is permitted to do.
- A real-world example is a shared Google Doc. Youâre logged in, so Gmail knows itâs you. But whether you can edit the doc, or only view it, or delete it, thatâs authorization deciding for you.
How do systems usually handle this? The common approach is to group permissions:
- Roles. Instead of setting rules for each person one by one, the system gives you a role like âadminâ, âeditorâ, or âviewerâ. This idea is called role-based access control, or RBAC, and it just means your role decides what you can do.
- Permissions. A role is really a bundle of permissions, the individual yes-or-no rules like âcan delete postsâ or âcan read billingâ. An admin role bundles many permissions, a viewer role bundles very few.
So in a blog app, an admin can publish and delete any post, an editor can edit posts, and a viewer can only read. Same login screen for everyone, but very different powers once theyâre in. That difference is authorization at work.
âď¸ Authentication vs Authorization
Hereâs the side-by-side. If you remember one thing from this lesson, make it this table.
| Authentication | Authorization | |
|---|---|---|
| Question it answers | Who are you? | What are you allowed to do? |
| When it happens | First, at login | After login, on each action |
| Example | Logging into Gmail with your password | Whether you can delete a shared doc |
| How itâs done | Passwords, OTP, MFA, biometrics | Roles, permissions, RBAC |
A quick memory trick: autheNtication is about who you are, authorizaTion is about what you can do. Identity first, then permission.
đ How They Work Together
These two arenât rivals, theyâre a team. They run in a fixed order, and the order really matters:
- First the user logs in, and the system runs authentication to confirm their identity.
- Only if that passes does the system move on to authorization and check their permissions.
- Then, based on those permissions, the action is either allowed or denied.
Hereâs that flow as a diagram.
Now, why does the order matter so much? Because one without the other is broken:
- Authentication without authorization means you let people in but never check what they can do. So a regular user might end up deleting everyoneâs data. The front door is locked, but every inside door is wide open.
- Authorization without authentication is even worse. Youâd be checking permissions for someone whose identity you never verified. Itâs like handing out boarding passes without ever looking at an ID. You canât safely decide what someone may do if you donât even know who they are.
So the safe pattern is always the same: authenticate first, authorize second. Identity, then permission, every single time.
Authorization on every request, not just at login
A common slip is to check permissions only once at login. But a logged-in user can still try things they shouldnât, like opening another userâs invoice by changing the URL. So the system must re-check authorization on each protected action, not just when you first sign in.
đ§Š Real Examples
Letâs make this concrete with a few app scenarios youâd actually meet:
- Gmail. Typing your password is authentication, Gmail confirming itâs really you. Then whether you can open a teammateâs mailbox is authorization, and the answer is usually no.
- A shared Google Doc. You log in, so youâre authenticated. But the doc owner gave you âview onlyâ, so when you try to edit, authorization steps in and blocks you.
- Netflix. Signing in with your account is authentication. Whether you can watch is authorization, and if your plan expired, youâre authenticated but not authorized to stream.
- A company dashboard. Every employee logs in the same way, thatâs authentication. But only managers can see salary reports, thatâs authorization based on their role.
Notice the pattern in all of them. Getting in is one question. What you can do once youâre in is a completely separate question.
â ď¸ Common Mistakes and Misconceptions
A few ideas trip people up constantly. Letâs clear them out:
- âAuthentication and authorization are the same thing.â Theyâre not. One proves identity, the other grants permission. Using the words interchangeably is the fastest way to look unprepared in an interview.
- âOnce you log in, you can do anything.â Logging in only proves who you are. What you can do still depends on your roles and permissions, which is a separate check.
- âYou can authorize someone without authenticating them first.â You canât, safely. Deciding what someone may do is meaningless if you havenât confirmed who they are. Identity has to come first.
- âA strong password covers everything.â A strong password helps with authentication, but it does nothing for authorization. A perfectly logged-in user can still be blocked from actions they shouldnât perform, and thatâs by design.
đ ď¸ Design Challenge
Try this one on your own to test yourself.
Imagine youâre building a simple blogging app with three kinds of users: admins, writers, and readers. Sketch out how authentication and authorization would work:
- How would each user prove who they are when they log in? Thatâs your authentication step.
- Once theyâre in, what should each role be allowed to do? For example, maybe admins can delete any post, writers can create and edit their own posts, and readers can only read.
- Where would you check permissions, just at login or on every action like âdelete this postâ?
Write down the roles, the permissions each one gets, and the order of the checks. This is exactly the kind of access-control thinking interviewers love to see.
đ§Š What Youâve Learned
You can now tell these two apart with confidence. Hereâs what youâve picked up.
- â Authentication proves who you are, using passwords, OTP, MFA, or biometrics.
- â Authorization decides what youâre allowed to do, using roles and permissions like RBAC.
- â Authentication always happens first, then authorization.
- â Authentication asks âwho are you?â, authorization asks âwhat can you do?â.
- â One without the other is broken, and permissions should be checked on every protected action.
Check Your Knowledge
Test what you learned. Pick an answer for each question, then click Check.
- 1
Which question does authentication answer?
Why: Authentication proves identity, answering 'who are you?', while authorization answers 'what can you do?'.
- 2
In the right order, which check happens first?
Why: You confirm identity first, then decide permissions, because you can't sensibly grant access to someone you haven't identified.
- 3
Combining a password with a one-time code sent to your phone is an example of what?
Why: Using two different proofs together, like something you know plus something you have, is multi-factor authentication.
- 4
Why should authorization be checked on every protected action, not just at login?
Why: A valid login does not mean every action is allowed, so each protected action needs its own permission check.
đ Whatâs Next?
Youâve got the core security idea down. Next, letâs look at how apps actually remember that youâre logged in and keep things fast and safe.
- Sessions vs JWT shows how apps keep you authenticated after login without asking for your password on every click.
- Rate Limiting Explained covers how systems stop abuse by capping how often someone can hit your endpoints.
Get these two next, and youâll have a solid grip on the security basics every backend and system design interview leans on.