#[non_exhaustive]pub enum OAuthErrorCode {
Show 18 variants
InvalidRequest,
InvalidClient,
InvalidGrant,
UnauthorizedClient,
UnsupportedGrantType,
InvalidScope,
AccessDenied,
UnsupportedResponseType,
ServerError,
TemporarilyUnavailable,
InvalidToken,
InsufficientScope,
InvalidTarget,
InvalidRedirectUri,
InvalidClientMetadata,
InvalidSoftwareStatement,
UnapprovedSoftwareStatement,
Other(String),
}Expand description
Machine-readable OAuth 2.0 error code
Covers the registered codes from RFC 6749 (authorization and token
endpoints), RFC 6750 (bearer token usage), RFC 8707 (resource
indicators) and RFC 7591 (dynamic client registration). Unregistered
extension codes are preserved as OAuthErrorCode::Other.
Serializes to/from its snake_case wire form:
use volga_oauth_core::OAuthErrorCode;
let code = OAuthErrorCode::InvalidToken;
assert_eq!(code.as_str(), "invalid_token");
assert_eq!(OAuthErrorCode::from("invalid_token"), code);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidRequest
The request is missing a required parameter, includes an unsupported parameter value, repeats a parameter or is otherwise malformed
InvalidClient
Client authentication failed
InvalidGrant
The provided authorization grant or refresh token is invalid, expired or revoked
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 requested scope is invalid, unknown or malformed
AccessDenied
The resource owner or authorization server denied the request
UnsupportedResponseType
The authorization server does not support obtaining an authorization code using this method
ServerError
The server encountered an unexpected condition
The server is currently unable to handle the request
InvalidToken
The access token is expired, revoked, malformed or otherwise invalid (RFC 6750)
InsufficientScope
The request requires higher privileges than provided by the access token (RFC 6750)
InvalidTarget
The requested resource is invalid, missing, unknown or malformed (RFC 8707)
InvalidRedirectUri
The value of one or more redirection URIs is invalid (RFC 7591)
InvalidClientMetadata
The value of one of the client metadata fields is invalid (RFC 7591)
InvalidSoftwareStatement
The software statement presented is invalid (RFC 7591)
UnapprovedSoftwareStatement
The software statement is not approved for use by this authorization server (RFC 7591)
Other(String)
An unregistered extension error code
Implementations§
Source§impl OAuthErrorCode
impl OAuthErrorCode
Sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
Returns the HTTP status code conventionally paired with this error code
Bearer-usage codes follow RFC 6750 Section 3.1 (invalid_token -> 401,
insufficient_scope -> 403); invalid_client maps to 401 and the
remaining token/authorization endpoint codes to 400 per RFC 6749 Section 5.2,
except server_error (500) and temporarily_unavailable (503).
Extension codes default to 400.
Trait Implementations§
Source§impl Clone for OAuthErrorCode
impl Clone for OAuthErrorCode
Source§fn clone(&self) -> OAuthErrorCode
fn clone(&self) -> OAuthErrorCode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OAuthErrorCode
impl Debug for OAuthErrorCode
Source§impl<'de> Deserialize<'de> for OAuthErrorCode
impl<'de> Deserialize<'de> for OAuthErrorCode
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<OAuthErrorCode, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<OAuthErrorCode, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for OAuthErrorCode
impl Display for OAuthErrorCode
impl Eq for OAuthErrorCode
Source§impl From<&str> for OAuthErrorCode
impl From<&str> for OAuthErrorCode
Source§fn from(code: &str) -> OAuthErrorCode
fn from(code: &str) -> OAuthErrorCode
Source§impl From<OAuthErrorCode> for OAuthError
impl From<OAuthErrorCode> for OAuthError
Source§fn from(error: OAuthErrorCode) -> OAuthError
fn from(error: OAuthErrorCode) -> OAuthError
Source§impl From<String> for OAuthErrorCode
impl From<String> for OAuthErrorCode
Source§fn from(code: String) -> OAuthErrorCode
fn from(code: String) -> OAuthErrorCode
Source§impl Hash for OAuthErrorCode
impl Hash for OAuthErrorCode
Source§impl PartialEq for OAuthErrorCode
impl PartialEq for OAuthErrorCode
Source§impl Serialize for OAuthErrorCode
impl Serialize for OAuthErrorCode
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for OAuthErrorCode
Auto Trait Implementations§
impl Freeze for OAuthErrorCode
impl RefUnwindSafe for OAuthErrorCode
impl Send for OAuthErrorCode
impl Sync for OAuthErrorCode
impl Unpin for OAuthErrorCode
impl UnsafeUnpin for OAuthErrorCode
impl UnwindSafe for OAuthErrorCode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.