Skip to content
What is OpenID Connect?
What is OAuth 2.0?
How do websites remember you?
How should apps store passwords?
What is MFA?
×

Authn vs. Authz

Every app asks you two questions. They sound alike. But they protect different things.

Tap the right side to continue →

Authentication (authn)

Authentication proves who you are.

First, the app checks that you are really you. Think of showing your ID at a ticket counter. No ID, no tickets.

Authorization (authz)

Authorization decides what you can do.

Once you're in, the app checks your permissions. Maya can open her inbox and her profile. But the admin door stays locked.

Authentication always comes first.

The app must know who you are before it can decide what you may do. So you pass gate one. Then gate two.

Three ways to prove who you are.

Something you know, like a password. Something you have, like your phone. Something you are, like your fingerprint.

A stolen password is not enough.

Multi-factor authentication asks for two proofs. Your password, and a code from your phone. A thief with only your password stays locked out.

Same bank, different powers.

A customer and a manager log in the same way. The customer sees only their own account. The manager can see every account. Being logged in does not mean you see everything.

Two common ways to set the rules.

Role-based: you get a role, like editor or viewer, and the role decides what you can do. Attribute-based: the app checks facts, like your department or your device.

One login, every app.

With single sign-on, you log in once. Then your mail, docs and chat all open. It is built on OAuth, a standard for passing permissions between apps.

For developers

Watch out for a confusing name.

Error 401 says unauthorized. But it really means: we don't know who you are. Error 403 means: we know you, but you're not allowed.

Quick check

Is it authentication or authorization? Tap your answer.

You type the wrong password. You can't get in.

You're logged in. But the admin page says access denied.

The app texts you a code to finish logging in.

Let's recap.

Authn: who are you?

You prove it with a password, a code or your fingerprint.

Authz: what can you do?

Your role and permissions decide.

First authentication. Then authorization.

Source: Cloudflare: Authn vs. authz.

×