401 Unauthorized: The request requires authentication. The client must identify itself. 401 Unauthorized means the request needs authentication and none was given, or the credentials were invalid. Despite the name, it is about who you are, not what you are allowed to do. Typical causes are a missing login session, an expired token or a wrong API key. The right reaction is to log in again or refresh the token. A front end often catches 401 globally and sends the user to the login page.
What should you keep in mind with 401 Unauthorized?
Do not confuse it with 403. A 401 says "I don't know who you are", while 403 says "I know who you are, and you may not do this". Getting this right helps clients react correctly, and it helps you when reading logs. A spike in 401s points at login or token problems; a spike in 403s points at permissions.
Use when an HTTP request returns an unexpected status code (4xx or 5xx, or a redirect loop), when a user pastes an error like "419 Page Expired", "422 Unprocessable Content", "502 Bad Gateway" or "CORS error", or when debugging API calls between a frontend and a Laravel/PHP or Node backend. Finds the cause from the status code, headers and logs before changing code.
Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues.
OWASP Top 10 security audit and secure coding guidelines for Laravel + React/Inertia.js applications. Use when auditing for vulnerabilities ("run OWASP audit", "security review", "check my app security") or writing secure Laravel code involving auth, payments, file uploads, or API design. Triggers on security-related tasks, payment handling, authentication, or any request to audit a Laravel codeba