Quick Answer
JWT authentication: client sends Authorization: Bearer header. AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer() validates the JWT signature, issuer, audience, and expiration. Claims from the token populate HttpContext.User. Apply [Authorize] to require authentication. Use [Authorize(Roles = "Admin")] for role-based access. Always use HTTPS to protect tokens in transit.
Answer
Authentication verifies user identity in Web API.
Common implementations:
JWT Bearer Tokens – stateless authentication for SPA and mobile apps.
Cookie authentication – mainly for browser-based apps.
Configured using AddAuthentication() and UseAuthentication().
S
SugharaIQ Editorial Team
Verified Answer
This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.