Problem code
invalid_token
| Status | 401 Unauthorized |
| Type | https://api.librarika.dev.raynux.com/problems/invalid_token |
| Title | Invalid token |
| Retry | After you get a new access token. |
| Headers | WWW-Authenticate: Bearer or DPoP with resource_metadata, and error="invalid_token" when a credential was sent |
What it means
The request has no credential, or its access token or API key is not valid: unknown, revoked, issued for another audience, or meant for another environment. A key or token of the wrong environment (a test key sent to production, or a production key sent to the test environment) also answers invalid_token; the API does not say which check failed.
What to do
Send Authorization: Bearer <token> (or Authorization: DPoP <token> with a DPoP proof for a DPoP-bound token). If you have a refresh token, refresh once; otherwise get a new token or ask the library for a new key. Check that the key's environment matches the host. See Tokens.
Example
HTTP/1.1 401 Unauthorized
Content-Type: application/problem+json
X-Request-ID: 01JD8Q3W6Y2N5K7M9P0R4S6T8V
{
"type": "https://api.librarika.dev.raynux.com/problems/invalid_token",
"title": "Invalid token",
"status": 401,
"code": "invalid_token",
"detail": "The access token is invalid or has been revoked.",
"request_id": "01JD8Q3W6Y2N5K7M9P0R4S6T8V"
}
The type URI https://api.librarika.dev.raynux.com/problems/invalid_token is this page. The detail above is an example of the English text; it is translated into the request's language and may change, so match on code, never on detail.