Draft a JSON error response for an invalid authentication token
Tests your ability to standardize API error contracts with RFC 7807. A strong answer returns 401 with type, title, detail, and instance, plus an actionable fix like re-authenticating. Red flag: 403, echoing the token, or exposing stack traces.
Tests whether you can design consistent, secure, and actionable HTTP error payloads that help developers debug without leaking internals. A strong answer returns HTTP 401 Unauthorized, adopts RFC 7807 problem details with type, title, detail, status, and instance, sets Content-Type to application/problem+json, and writes a detail message that tells the caller exactly how to recover such as refreshing the token or re-authenticating.
Read the original → rfc-editor.org
- #api design
- #http
- #rfc 7807
- #error handling
- #authentication
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.