#[non_exhaustive]pub enum ErrorCode {
InvalidRequest,
InvalidClient,
InvalidGrant,
UnauthorizedClient,
UnsupportedGrantType,
InvalidScope,
UnsupportedPopKey,
IncompatibleAceProfiles,
Other(i32),
}Expand description
Error code specifying what went wrong for a token request, as specified in section 5.2 of RFC 6749 and section 5.8.3 of RFC 9200.
An error code is used in the ErrorResponse.
§Example
For example, if you wish to indicate in your error response that the client is not authorized:
let request = ErrorResponse::builder()
.error(ErrorCode::UnauthorizedClient)
.build()?;It’s also possible to use your own value for a custom error code, as defined in section 8.4 of RFC 9200:
let request = ErrorResponse::builder()
// Values less than 65536 marked as private use.
.error(ErrorCode::Other(-99999))
.build()?;Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidRequest
The request is missing a required parameter, includes an unsupported parameter value (other than grant type), repeats a parameter, includes multiple credentials, utilizes more than one mechanism for authenticating the client, or is otherwise malformed.
InvalidClient
Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method)
InvalidGrant
The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.
The authenticated client is not authorized to use this authorization grant type.
UnsupportedGrantType
The authorization grant type is not supported by the authorization server.
InvalidScope
The authorization grant type is not supported by the authorization server.
UnsupportedPopKey
The client submitted an asymmetric key in the token request that the RS cannot process.
IncompatibleAceProfiles
The client and the RS it has requested an access token for do not share a common profile.
Other(i32)
An unspecified error code along with its representation in CBOR.
See section 8.4 of RFC 9200 for details.