Skip to content
AITermsLab
–points–day streak

Authentication vs authorization: what's the difference?

Authentication checks who you are, usually with a log-in. Authorization decides what you're allowed to do once the app knows who you are. Authentication always comes first.

Last updated

What each one means

Authentication
Authentication is how an app checks that you are who you say you are, for example with an email and password.
Authorization
Authorization is how an app decides what you're allowed to do once it knows who you are, like which pages you can open or change.

Side by side

Authentication compared with Authorization
Authen­ticationAuthor­ization
The question it answersWho are you?What are you allowed to do?
When it happensFirst, when you log inNext, on every request after that
How it worksYou prove it with a password, a code or a passkeyThe app checks your role and its rules for that page or action
What you seeA log-in screenUsually nothing, until something is refused
Who controls itYou: you can change your passwordThe app's owner or an admin sets your permissions
When it failsA 401 error: log in firstA 403 error: you're not allowed
At a members' clubThe doorman checking your cardWhich rooms your card opens

An example: a shared document

You log in to a document app with your email and a code from your phone. That's authentication. A colleague has shared a report with you as view only, so you can read it but can't edit it. That's authorization. Ask for edit access and your log-in stays the same: only your permissions change.

See both: log in, then open someone else's orders

The demo is a pretend log-in for sam@example.com. A wrong password fails authentication. Log in and your own orders open. Try Alex's orders and the backend refuses: authentication passed, but authorization says Sam can only see Sam's orders.

Pretend account: sam@example.com, password pancakes. Log in, then open your own orders and then Alex's. Nothing you type leaves this page.

Your screen (the frontend)

Log in to see your orders.

The backend (hidden from visitors)

Waiting for a request.

Common questions

Can you have authorization without authentication?

Only for things anyone may do, like reading a public page. To give one person their own permissions, the app first has to know who they are.

Is OAuth authentication or authorization?

Strictly, authorization: OAuth lets one app use parts of your account on another without your password. "Sign in with" buttons add an authentication layer on top, usually OpenID Connect.

What is a role?

A named set of permissions, like viewer, editor or admin. Instead of setting rules person by person, the app gives each person a role.