Errors
Every SDK raises the same error for the same failure. The kinds, the codes, and the descriptions
below come from one table, test/contract/errors.json,
and each SDK ships a copy generated by ./dev reference. CI fails when a copy or this page drifts
from the table.
Every error’s message reads masks: {code}: {description}. A failure the table lists gets the description in the
last table, with the parts in braces filled in.
| Kind | Means | Code | Carries |
|---|---|---|---|
Refused |
masks answered a request with an OAuth error, or the SDK found the answer unusable. | the code masks answered with, or server_error when the answer was not an OAuth error | code, description, uri, status |
InvalidToken |
A token, an ID token, a logout token, or a DPoP proof failed a check in the SDK. missing says the request carried no token at all, and a resource server’s challenge then carries no code. | invalid_token for a token, invalid_dpop_proof for a proof | code, description, missing |
Forbidden |
The sign-in or token is valid and lacks a scope, a role, or an organization the route needs. | insufficient_scope, insufficient_role, or insufficient_organization | code, description, scope |
Unavailable |
masks, its keys, or a store the SDK depends on could not be reached, so nothing can be decided. | temporarily_unavailable | code, description |
Insecure |
A URL is plain http off this machine, or is not an http or https URL at all. | insecure_url | code, description |
Foreign |
A URL belongs to another origin than the one the tokens are held for. | foreign_origin | code, description |
DelegationRefused |
masks refused a delegation call. sign_in_again says the person has to sign in again, and secret carries a replacement secret when masks rotated it. | the code masks answered with | code, description, status, secret, sign_in_again |
DelegationUnavailable |
masks or the provider did not answer a delegation call. secret carries a replacement secret when masks rotated it before failing. | temporarily_unavailable | code, description, secret |
Each kind spells its name the way its language does. A dash means the SDK has no such call.
| Kind | Ruby | JavaScript | Browser | Python | Go |
|---|---|---|---|---|---|
Refused |
Masks::Client::Refused |
Refused |
Refused |
masks.Refused |
*masks.Refused |
InvalidToken |
Masks::Client::InvalidToken |
InvalidToken |
InvalidToken |
masks.InvalidToken |
*masks.InvalidToken |
Forbidden |
Masks::Client::Forbidden |
Forbidden |
– | masks.Forbidden |
*masks.Forbidden |
Unavailable |
Masks::Client::Unavailable |
Unavailable |
– | masks.Unavailable |
*masks.Unavailable |
Insecure |
Masks::Client::Insecure |
Insecure |
Insecure |
masks.Insecure |
*masks.Insecure |
Foreign |
Masks::Client::Foreign |
Foreign |
– | masks.Foreign |
*masks.Foreign |
DelegationRefused |
Masks::Client::Delegations::Refused |
DelegationRefused |
– | masks.DelegationRefused |
*masks.DelegationRefused |
DelegationUnavailable |
Masks::Client::Delegations::Unavailable |
DelegationUnavailable |
– | masks.DelegationUnavailable |
*masks.DelegationUnavailable |
| Code | From | Means |
|---|---|---|
invalid_request |
masks | The request is missing a parameter, repeats one, or is malformed. |
invalid_client |
masks | The client is unknown, or its credentials did not check out. |
invalid_grant |
masks | The code, refresh token, or assertion is invalid, expired, revoked, or was issued to another client. |
unauthorized_client |
masks | The client may not use this grant type or this endpoint. |
unsupported_grant_type |
masks | masks does not support that grant type. |
unsupported_response_type |
masks | masks does not support that response type. |
invalid_scope |
masks | A scope asked for is unknown, malformed, or more than the client may hold. |
access_denied |
masks | The person or masks refused the request. |
server_error |
masks | masks failed, or answered with something the SDK could not read. |
temporarily_unavailable |
masks | masks, or something the SDK depends on, is not answering for now. |
login_required |
masks | Nobody is signed in, and the request asked masks not to prompt. |
interaction_required |
masks | masks needs the person to do something, and the request asked it not to prompt. |
consent_required |
masks | The person has not allowed this app in, and the request asked masks not to prompt. |
invalid_token |
masks | The access token is expired, revoked, malformed, or was issued for another resource. |
insufficient_scope |
masks | The token is valid and does not carry a scope the request needs. |
insufficient_role |
the SDK | The sign-in is valid and the person does not hold a role the route needs in the organization signed in to. |
insufficient_organization |
the SDK | The sign-in is valid and names no organization, or another one than the route needs. |
invalid_dpop_proof |
masks | The DPoP proof is missing, malformed, signed by the wrong key, made for another request, or used before. |
use_dpop_nonce |
masks | The DPoP proof needs the nonce masks sent in the DPoP-Nonce header. |
slow_down |
masks | The device is polling faster than masks allows. |
authorization_pending |
masks | Nobody has approved the device code yet. |
expired_token |
masks | The device code expired before anyone approved it. |
invalid_target |
masks | The resource asked for is unknown, or not one the client may reach. |
invalid_client_metadata |
masks | A registration names metadata masks refuses. |
invalid_request_object |
masks | The request object is malformed or its signature did not check out. |
invalid_authorization_details |
masks | The authorization details are malformed or ask for more than the client may hold. |
invalid_key |
masks | A key sent to masks is malformed, private, or signs with an algorithm masks refuses. |
invalid_audience |
masks | A token names an audience masks does not serve. |
invalid_issuer |
masks | The issuer named is unknown, or its discovery document does not describe it. |
invalid_state |
the SDK | The state that came back is not the one this sign-in started with. |
invalid_style |
the SDK | The issuer does not serve avatars in that style. |
handshake_required |
the SDK | This app has not shaken hands with its issuer, so it holds no credentials. |
insecure_url |
the SDK | A URL is plain http off this machine, or is not http or https. |
foreign_origin |
the SDK | A URL belongs to another origin than the one the tokens are held for. |
Descriptions
Section titled “Descriptions”| Failure | Kind | Code | Description |
|---|---|---|---|
no_token |
InvalidToken |
invalid_token |
the request carries no token |
not_a_jwt |
InvalidToken |
invalid_token |
that token is not a signed JWT |
no_key |
InvalidToken |
invalid_token |
{issuer} publishes no key {kid} |
not_signed_by |
InvalidToken |
invalid_token |
that token was not signed by {issuer} |
not_an_algorithm |
InvalidToken |
invalid_token |
{algorithm} is not an algorithm masks signs with |
wrong_type |
InvalidToken |
invalid_token |
that token is typed {typ}, not {wanted} |
expired |
InvalidToken |
invalid_token |
that token has expired |
not_valid_yet |
InvalidToken |
invalid_token |
that token is not valid yet |
issued_in_future |
InvalidToken |
invalid_token |
that token was issued in the future |
other_issuer |
InvalidToken |
invalid_token |
that token was issued by another server |
other_audience |
InvalidToken |
invalid_token |
that token was issued for another app |
missing_claims |
InvalidToken |
invalid_token |
that token is missing {claims} |
unverified |
InvalidToken |
invalid_token |
that token could not be verified |
too_old |
InvalidToken |
invalid_token |
the person signed in longer ago than max_age allows |
bound_as_bearer |
InvalidToken |
invalid_token |
that token is held to a key, so it is presented as DPoP with a proof |
unbound_as_dpop |
InvalidToken |
invalid_token |
that token is held to no key, so it is presented as Bearer |
not_active |
InvalidToken |
invalid_token |
the issuer reports this token is not active |
no_id_token |
InvalidToken |
invalid_token |
the token endpoint answered without an ID token |
id_token_other_sign_in |
InvalidToken |
invalid_token |
that ID token was issued for another sign-in |
id_token_other_client |
InvalidToken |
invalid_token |
that ID token was issued to another client |
id_token_several_audiences |
InvalidToken |
invalid_token |
that ID token names several audiences and was not issued to this client |
id_token_other_access_token |
InvalidToken |
invalid_token |
that ID token was issued with another access token |
id_token_other_organization |
InvalidToken |
invalid_token |
that ID token does not name the organization {organization} |
not_a_logout |
InvalidToken |
invalid_token |
that token is not about a logout |
logout_names_nobody |
InvalidToken |
invalid_token |
that logout token names neither a subject nor a session |
logout_with_nonce |
InvalidToken |
invalid_token |
that logout token carries a nonce, so it is an ID token |
one_proof |
InvalidToken |
invalid_dpop_proof |
exactly one DPoP proof is required |
proof_not_a_jwt |
InvalidToken |
invalid_dpop_proof |
that proof is not a signed JWT |
proof_type |
InvalidToken |
invalid_dpop_proof |
a proof is typed {typ} |
proof_algorithm |
InvalidToken |
invalid_dpop_proof |
{algorithm} is not an algorithm a proof may use |
proof_no_key |
InvalidToken |
invalid_dpop_proof |
a proof carries the public key that signed it |
proof_key_private |
InvalidToken |
invalid_dpop_proof |
a proof key is public |
proof_key_unreadable |
InvalidToken |
invalid_dpop_proof |
that proof carries a key this API cannot read |
proof_unsigned |
InvalidToken |
invalid_dpop_proof |
that proof was not signed by the key it carries |
proof_other_key |
InvalidToken |
invalid_dpop_proof |
that proof was signed by another key than the token is held to |
proof_other_token |
InvalidToken |
invalid_dpop_proof |
that proof was made for another token |
proof_other_method |
InvalidToken |
invalid_dpop_proof |
that proof was made for another method |
proof_other_url |
InvalidToken |
invalid_dpop_proof |
that proof was made for another URL |
proof_not_now |
InvalidToken |
invalid_dpop_proof |
that proof was not made just now |
proof_no_jti |
InvalidToken |
invalid_dpop_proof |
a proof carries a jti |
proof_replayed |
InvalidToken |
invalid_dpop_proof |
that proof has already been used |
no_scope |
Forbidden |
insufficient_scope |
this token does not carry {scope} |
not_granted |
Forbidden |
insufficient_scope |
masks did not grant {scopes} |
no_privilege |
Forbidden |
insufficient_scope |
this account does not hold the {privilege} privilege |
no_organization |
Forbidden |
insufficient_organization |
this sign-in names no organization |
other_organization |
Forbidden |
insufficient_organization |
this sign-in is for {held}, and this needs {wanted} |
other_role |
Forbidden |
insufficient_role |
{role} in {organization} is not {roles} |
unreachable |
Unavailable |
temporarily_unavailable |
{host} could not be reached |
keys_unreachable |
Unavailable |
temporarily_unavailable |
{issuer} could not be reached for its keys |
replay_store_unreachable |
Unavailable |
temporarily_unavailable |
the replay store could not be reached |
replay_store_answer |
Unavailable |
temporarily_unavailable |
the replay store answered with something other than true or false |
store_unreachable |
Unavailable |
temporarily_unavailable |
the store could not be reached |
not_checked |
Unavailable |
temporarily_unavailable |
the token could not be checked |
plain_http |
Insecure |
insecure_url |
plain http is allowed only on this machine: {url} |
not_http |
Insecure |
insecure_url |
{url} is not an http or https URL |
other_origin |
Foreign |
foreign_origin |
that URL belongs to another origin: {url} |
tokens_only_for |
Foreign |
foreign_origin |
tokens are held only for {origins}, not {origin} |
answered_status |
Refused |
server_error |
{url} answered {status} |
not_json |
Refused |
server_error |
{url} answered with something other than JSON |
not_an_object |
Refused |
server_error |
{url} answered with JSON that is not an object |
too_large |
Refused |
server_error |
{url} answered with more than a megabyte |
publishes_nothing |
Refused |
invalid_issuer |
{issuer} publishes no {name} |
names_another |
Refused |
invalid_issuer |
{issuer} publishes a document naming {found} |
resource_names_another |
Refused |
invalid_target |
{url} publishes metadata naming {found} |
state_mismatch |
Refused |
invalid_state |
the state did not match the one this sign-in started with |
nothing_in_flight |
Refused |
invalid_request |
this browser has no sign-in in flight |
no_callback_code |
Refused |
invalid_request |
the callback carried no code |
code_expired |
Refused |
expired_token |
the code expired before anyone approved it |
no_refresh_token |
Refused |
invalid_grant |
there is no refresh token to renew these tokens with |
not_held_to_key |
Refused |
invalid_dpop_proof |
the token endpoint answered with a token that is not held to this key |
no_avatars |
Refused |
invalid_style |
{issuer} does not serve {style} avatars |
not_connected |
Refused |
handshake_required |
this app has not shaken hands with {issuer} |
nothing_connected |
DelegationRefused |
access_denied |
masks connected nothing for {provider} |
no_refresh_for_connection |
DelegationRefused |
invalid_grant |
masks issued no refresh token to keep the connection with |
delegation_not_answering |
DelegationUnavailable |
temporarily_unavailable |
masks is not answering |
Token checks
Section titled “Token checks”Every SDK verifies an access token, an ID token, and a logout token the same way. The cases below
come from test/contract/tokens.json, which holds the
signing keys, the discovery document, and a base token of each kind with its times as offsets from
now. Each case changes one thing about a base token and names the failure it ends in. Each SDK signs
the cases when its tests run and checks that its verifier answers as the case says. The browser
package checks the ID token cases, since it verifies nothing else.
| Token | Case | Ends in |
|---|---|---|
| Access token | a fresh access token is accepted | accepted |
| Access token | an access token signed with the issuer’s EC key is accepted | accepted |
| Access token | an access token that expired 15 seconds ago is still within the leeway | accepted |
| Access token | an access token valid in 15 seconds is within the leeway | accepted |
| Access token | an access token naming this resource among several audiences is accepted | accepted |
| Access token | an expired access token is refused | expired |
| Access token | an access token that is not valid yet is refused | not_valid_yet |
| Access token | an access token issued in the future is refused | issued_in_future |
| Access token | an access token from another issuer is refused | other_issuer |
| Access token | an access token for another resource is refused | other_audience |
| Access token | an access token without exp is refused | missing_claims |
| Access token | an access token without jti is refused | missing_claims |
| Access token | an ID token presented as an access token is refused | wrong_type |
| Access token | an untyped token presented as an access token is refused | wrong_type |
| Access token | an access token naming a key the issuer does not publish is refused | no_key |
| Access token | an access token signed by another key under the published kid is refused | not_signed_by |
| Access token | an access token signed with a shared secret is refused | not_an_algorithm |
| Access token | an unsigned access token is refused | not_an_algorithm |
| Access token | a string that is not a JWT is refused | not_a_jwt |
| Access token | a token with two segments is refused | not_a_jwt |
| ID token | a fresh ID token is accepted | accepted |
| ID token | an untyped ID token is accepted | accepted |
| ID token | an ID token signed with the issuer’s EC key is accepted | accepted |
| ID token | an ID token for several audiences that names this client as the authorized party is accepted | accepted |
| ID token | an ID token without at_hash is accepted | accepted |
| ID token | an ID token without auth_time is accepted when no max_age was asked for | accepted |
| ID token | an access token presented as an ID token is refused | wrong_type |
| ID token | an ID token for another client is refused | other_audience |
| ID token | an ID token for several audiences without an authorized party is refused | id_token_several_audiences |
| ID token | an ID token whose authorized party is another client is refused | id_token_other_client |
| ID token | an ID token carrying another sign-in’s nonce is refused | id_token_other_sign_in |
| ID token | an ID token carrying no nonce is refused | id_token_other_sign_in |
| ID token | an ID token hashing another access token is refused | id_token_other_access_token |
| ID token | an ID token from a sign-in older than max_age is refused | too_old |
| ID token | an ID token without auth_time is refused when max_age was asked for | too_old |
| ID token | an ID token without sub is refused | missing_claims |
| ID token | an ID token without iat is refused | missing_claims |
| ID token | an expired ID token is refused | expired |
| ID token | an ID token issued in the future is refused | issued_in_future |
| ID token | an ID token from another issuer is refused | other_issuer |
| ID token | an ID token signed by another key under the published kid is refused | not_signed_by |
| Logout token | a fresh logout token is accepted | accepted |
| Logout token | a logout token naming only a session is accepted | accepted |
| Logout token | a logout token naming only a subject is accepted | accepted |
| Logout token | a logout token naming nobody is refused | logout_names_nobody |
| Logout token | a logout token carrying a nonce is refused | logout_with_nonce |
| Logout token | a logout token without events is refused | not_a_logout |
| Logout token | a logout token about another event is refused | not_a_logout |
| Logout token | a logout token whose event is not an object is refused | not_a_logout |
| Logout token | an ID token presented as a logout token is refused | wrong_type |
| Logout token | a logout token without jti is refused | missing_claims |
| Logout token | a logout token without iat is refused | missing_claims |
| Logout token | a logout token issued in the future is refused | issued_in_future |
| Logout token | an expired logout token is refused | expired |
| Logout token | a logout token for another client is refused | other_audience |