Errors

from aioauth import errors

Errors used throughout the project.


exception MethodNotAllowedError(request: TRequest, description: str | None = None, headers: HTTPHeaderDict | None = None, state: str | None = None)[source]

The request is valid, but the method trying to be accessed is not available to the resource owner.

description: str = 'HTTP method is not allowed.'
status_code: HTTPStatus = 405
error: Literal['invalid_request', 'invalid_client', 'invalid_grant', 'invalid_scope', 'unauthorized_client', 'unsupported_grant_type', 'unsupported_response_type', 'unsupported_token_type', 'insecure_transport', 'mismatching_state', 'method_is_not_allowed', 'server_error', 'temporarily_unavailable'] = 'method_is_not_allowed'
exception InvalidRequestError(request: TRequest, description: str | None = None, headers: HTTPHeaderDict | None = None, state: str | None = None)[source]

The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.

error: typing_extensions.Literal[invalid_request] = 'invalid_request'
exception InvalidClientError(request: TRequest, description: str | None = None, headers: HTTPHeaderDict | None = None, state: str | None = None)[source]

Client authentication failed (e.g. unknown client, no client authentication included, or unsupported authentication method). The authorization server may return an HTTP 401 (Unauthorized) status code to indicate which HTTP authentication schemes are supported. If the client attempted to authenticate via the Authorization request header field, the authorization server must respond with an HTTP 401 (Unauthorized) status code, and include the WWW-Authenticate response header field matching the authentication scheme used by the client.

error: Literal['invalid_request', 'invalid_client', 'invalid_grant', 'invalid_scope', 'unauthorized_client', 'unsupported_grant_type', 'unsupported_response_type', 'unsupported_token_type', 'insecure_transport', 'mismatching_state', 'method_is_not_allowed', 'server_error', 'temporarily_unavailable'] = 'invalid_client'
status_code: HTTPStatus = 401
exception InsecureTransportError(request: TRequest, description: str | None = None, headers: HTTPHeaderDict | None = None, state: str | None = None)[source]

An exception will be thrown if the current request is not secure.

description: str = 'OAuth 2 MUST utilize https.'
error: Literal['invalid_request', 'invalid_client', 'invalid_grant', 'invalid_scope', 'unauthorized_client', 'unsupported_grant_type', 'unsupported_response_type', 'unsupported_token_type', 'insecure_transport', 'mismatching_state', 'method_is_not_allowed', 'server_error', 'temporarily_unavailable'] = 'insecure_transport'
exception UnsupportedGrantTypeError(request: TRequest, description: str | None = None, headers: HTTPHeaderDict | None = None, state: str | None = None)[source]

The authorization grant type is not supported by the authorization server.

error: Literal['invalid_request', 'invalid_client', 'invalid_grant', 'invalid_scope', 'unauthorized_client', 'unsupported_grant_type', 'unsupported_response_type', 'unsupported_token_type', 'insecure_transport', 'mismatching_state', 'method_is_not_allowed', 'server_error', 'temporarily_unavailable'] = 'unsupported_grant_type'
exception UnsupportedResponseTypeError(request: TRequest, description: str | None = None, headers: HTTPHeaderDict | None = None, state: str | None = None)[source]

The authorization server does not support obtaining an authorization code using this method.

error: Literal['invalid_request', 'invalid_client', 'invalid_grant', 'invalid_scope', 'unauthorized_client', 'unsupported_grant_type', 'unsupported_response_type', 'unsupported_token_type', 'insecure_transport', 'mismatching_state', 'method_is_not_allowed', 'server_error', 'temporarily_unavailable'] = 'unsupported_response_type'
exception InvalidGrantError(request: TRequest, description: str | None = None, headers: HTTPHeaderDict | None = None, state: str | None = None)[source]

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.

See RFC6749 section 5.2.

error: Literal['invalid_request', 'invalid_client', 'invalid_grant', 'invalid_scope', 'unauthorized_client', 'unsupported_grant_type', 'unsupported_response_type', 'unsupported_token_type', 'insecure_transport', 'mismatching_state', 'method_is_not_allowed', 'server_error', 'temporarily_unavailable'] = 'invalid_grant'
exception MismatchingStateError(request: TRequest, description: str | None = None, headers: HTTPHeaderDict | None = None, state: str | None = None)[source]

Unable to securely verify the integrity of the request and response.

description: str = 'CSRF Warning! State not equal in request and response.'
error: typing_extensions.Literal[mismatching_state] = 'mismatching_state'
exception UnauthorizedClientError(request: TRequest, description: str | None = None, headers: HTTPHeaderDict | None = None, state: str | None = None)[source]

The authenticated client is not authorized to use this authorization grant type.

error: Literal['invalid_request', 'invalid_client', 'invalid_grant', 'invalid_scope', 'unauthorized_client', 'unsupported_grant_type', 'unsupported_response_type', 'unsupported_token_type', 'insecure_transport', 'mismatching_state', 'method_is_not_allowed', 'server_error', 'temporarily_unavailable'] = 'unauthorized_client'
exception InvalidScopeError(request: TRequest, description: str | None = None, headers: HTTPHeaderDict | None = None, state: str | None = None)[source]

The requested scope is invalid, unknown, or malformed, or exceeds the scope granted by the resource owner.

See RFC6749 section 5.2.

error: Literal['invalid_request', 'invalid_client', 'invalid_grant', 'invalid_scope', 'unauthorized_client', 'unsupported_grant_type', 'unsupported_response_type', 'unsupported_token_type', 'insecure_transport', 'mismatching_state', 'method_is_not_allowed', 'server_error', 'temporarily_unavailable'] = 'invalid_scope'
exception ServerError(request: TRequest, description: str | None = None, headers: HTTPHeaderDict | None = None, state: str | None = None)[source]

The authorization server encountered an unexpected condition that prevented it from fulfilling the request. (This error code is needed because a HTTP 500 (Internal Server Error) status code cannot be returned to the client via a HTTP redirect.)

error: Literal['invalid_request', 'invalid_client', 'invalid_grant', 'invalid_scope', 'unauthorized_client', 'unsupported_grant_type', 'unsupported_response_type', 'unsupported_token_type', 'insecure_transport', 'mismatching_state', 'method_is_not_allowed', 'server_error', 'temporarily_unavailable'] = 'server_error'
exception TemporarilyUnavailableError(request: TRequest, description: str | None = None, headers: HTTPHeaderDict | None = None, state: str | None = None)[source]

The authorization server is currently unable to handle the request due to a temporary overloading or maintenance of the server. (This error code is needed because a HTTP 503 (Service Unavailable) status code cannot be returned to the client via a HTTP redirect.)

error: Literal['invalid_request', 'invalid_client', 'invalid_grant', 'invalid_scope', 'unauthorized_client', 'unsupported_grant_type', 'unsupported_response_type', 'unsupported_token_type', 'insecure_transport', 'mismatching_state', 'method_is_not_allowed', 'server_error', 'temporarily_unavailable'] = 'temporarily_unavailable'
exception InvalidRedirectURIError(request: TRequest, description: str | None = None, headers: HTTPHeaderDict | None = None, state: str | None = None)[source]

The requested redirect URI is missing or not allowed.

error: Literal['invalid_request', 'invalid_client', 'invalid_grant', 'invalid_scope', 'unauthorized_client', 'unsupported_grant_type', 'unsupported_response_type', 'unsupported_token_type', 'insecure_transport', 'mismatching_state', 'method_is_not_allowed', 'server_error', 'temporarily_unavailable'] = 'invalid_request'
exception UnsupportedTokenTypeError(request: TRequest, description: str | None = None, headers: HTTPHeaderDict | None = None, state: str | None = None)[source]

The authorization server does not support the revocation of the presented token type. That is, the client tried to revoke an access token on a server not supporting this feature.

error: Literal['invalid_request', 'invalid_client', 'invalid_grant', 'invalid_scope', 'unauthorized_client', 'unsupported_grant_type', 'unsupported_response_type', 'unsupported_token_type', 'insecure_transport', 'mismatching_state', 'method_is_not_allowed', 'server_error', 'temporarily_unavailable'] = 'unsupported_token_type'