HTTP Status Code 561 – Unauthorized
The HTTP status code 561 – Unauthorized is a non-standard code that might be used in specific applications or services to indicate that a client request has not been completed due to lack of valid authentication credentials. This is similar in concept to the standard 401 – Unauthorized status code.
Example 1: API Request Without Token
Consider a scenario where a client attempts to access a protected API endpoint without providing an authentication token. The server, which uses a custom status code 561 for unauthorized access, responds as follows:
HTTP/1.1 561 Unauthorized
Content-Type: application/json
{
"error": "Access Denied",
"message": "Authentication token is missing."
}
In this response, the server indicates to the client that the request is unauthorized due to the absence of an authentication token.
Example 2: Invalid Credentials
In another scenario, a user tries to log in to a web application using invalid credentials. The server responds with a status code 561, indicating unauthorized access:
HTTP/1.1 561 Unauthorized
Content-Type: text/plain
Invalid username or password. Please try again.
Here, the server communicates that the login attempt was unsuccessful due to incorrect credentials.
Example 3 Scenario
# Client sends a request example. GET /example HTTP/1.1 Host: www.example.com # Server Response HTTP/1.1 561 561 Unauthorized Date: Wed, 09 Oct 2024 23:14:51 GMT Server: ExampleServer/1.0 Content-Type: application/json { "error": "Description of the error for 561" }
Example 4 Scenario
# Client sends another example request. POST /another-example HTTP/1.1 Host: www.example.com # Server Response HTTP/1.1 561 561 Unauthorized Date: Wed, 09 Oct 2024 23:14:51 GMT Server: ExampleServer/1.0 Content-Type: application/json { "error": "Detailed message for 561" }
Summary
While HTTP status code 561 is not a standard status code, it can be employed in specific systems to denote unauthorized access, similar to the standard 401 status code. It is crucial for developers to document such custom codes clearly in their API documentation to avoid confusion among clients who might expect standard HTTP status codes.