Authentication failed

Status

401
400

Meaning

The API may respond with ‘Authentication failed’ if you’ve executed a request against any route of the API and authentication validation failed.

Ending in 401 response then may happen as cause of …

  • authentication has failed with given credentials. Then you need to check credentials and try again.
  • authentication has failed because credentials are missing. Then you need to set value for request header keys ‘X-Auth-UserId’ and ‘X-Auth-Token’.

Ending in 400 response then may happen as cause of …

  • authentication has failed because the value you’ve passed for request header key ‘X-Auth-UserId’ doesn’t match UUID type.

Semantically the 401 response status code is equivalent to the HyperText Transfer Protocol (HTTP) 401 Unauthorized response status code and the 400 response status code is equivalent to 400 Bad Request. The 401 error indicates that validation process of the authentication components passed by the client at request time ended in a fail/invalid state. The 400 error indicates that the request already failed before the validation process of the authentication components passed by the client has been started.

The 401 as well as the 400 error are errors which are solely a client-side problem. In case of 401 error it is the client’s fault if value of needed authentication components are either missing or wrong. And in case of 400 error it is the client’s fault if value of a needed authentication component doesn’t match the defined type.

This is the reason why this types of error are categorized within the scope of client-side (4xx) responses.

Request

GET https://api.gridscale.io/hybrid-core/v1/sites

Response

Header in case of 401 error:

HTTP/1.1 401 Unauthorized
Content-Type: application/json; charset=utf-8
...

Body in case of 401 error:

{
  "errors": [
    {
      "type": "https://my.gridscale.io/docs/apis/problems/hybrid-core/v1/authentication-failed",
      "title": "Authentication failed",
      "status": 401,
      "detail": "Authentication failed with given credentials. Please check credentials and try again.",
      "DocURL": "https://my.gridscale.io/docs/apis/hybrid-core/v1/introduction/#auth",
    }
  ]
}

Header in case of 400 error:

HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
...

Body in case of 400 error:

{
  "errors": [
    {
      "type": "https://my.gridscale.io/docs/apis/problems/hybrid-core/v1/authentication-failed",
      "title": "Authentication failed",
      "status": 400,
      "detail": "Value for header's key 'X-Auth-UserId' doesn't match UUID type: 'abc-01'.",
      "DocURL": "https://my.gridscale.io/docs/apis/hybrid-core/v1/introduction/#auth",
    }
  ]
}