Next.js › Authentication & Authorization in Next.js

What is the difference between authentication and authorization in a Next.js application?

Beginner

Answer

Authentication confirms who a user is, usually through a login form or a third party sign in provider, while authorization decides what that authenticated user is allowed to do or see, such as whether they can access an admin page. Both work together to keep an app secure and personalized.
// Authentication: verifying login credentials
// Authorization: checking user.role === 'admin' before showing a page
Real-world example A blogging platform authenticates a writer when they log in, then authorizes them to edit only their own posts while blocking them from editing posts written by other authors.

Common follow-ups: What tools are commonly used to add authentication to a Next.js app?;How do you protect a specific page so only logged in users can view it?