Menu

The Difference Between Authentication and Authorization
📰

The Difference Between Authentication and Authorization

DEV Community: authentication·Soumyajit Mukherjee·about 15 hours ago
#g5I6wPA6
Reading 0:00
15s threshold

Authentication and authorization are often confused.

They answer two completely different questions.

Authentication

Authentication asks:

Who are you?

Examples include:

Passwords

Passkeys

OAuth

Multi-factor authentication

Biometrics When a user logs in, the system authenticates their identity.

Authorization

Authorization asks:

What are you allowed to do?

Suppose Alice is authenticated.

That doesn't mean Alice should be able to:

Delete every user View financial reports Modify system settings

Enter fullscreen mode

Exit fullscreen mode

The application needs authorization rules.

Example

Imagine an API:

DELETE /users/123

Enter fullscreen mode

Exit fullscreen mode

Authentication determines:

Is this request associated with Alice?

Enter fullscreen mode

Exit fullscreen mode

Authorization determines:

Is Alice allowed to delete user 123?

Enter fullscreen mode

Exit fullscreen mode

Role-Based Authorization

A simple system might define:

const roles = { USER : [ " read " ], ADMIN : [ "…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.