.NET › Authentication & Authorization (Identity, JWT, OAuth)

What is the difference between authentication and authorization in ASP.NET Core?

Beginner

Answer

Authentication answers 'who are you?' -- verifying a user's identity, typically producing a ClaimsPrincipal representing the authenticated user. Authorization answers 'what are you allowed to do?' -- deciding whether an authenticated (or even anonymous) user is permitted to access a specific resource or perform an action, evaluated after authentication has established identity.
app.UseAuthentication();  // establishes WHO the user is
app.UseAuthorization();   // decides WHAT they can access

[Authorize(Roles = "Admin")]
public IActionResult DeleteUser(int id) { ... }
Real-world example A request with a valid login token passes authentication (identity confirmed) but still receives a 403 Forbidden from authorization if that user lacks the Admin role required for a specific delete endpoint.

Common follow-ups: What HTTP status codes correspond to failed authentication versus failed authorization?;How does ASP.NET Core represent an authenticated user internally?