ErrorsΒΆ

from aioauth import errors

Errors used throughout the project.


exception MethodNotAllowedError(request: TRequest, description: Optional[str] = None, headers: Optional[aioauth.collections.HTTPHeaderDict] = 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: http.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: Optional[str] = None, headers: Optional[aioauth.collections.HTTPHeaderDict] = 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: Literal[invalid_request] = 'invalid_request'ΒΆ
exception InvalidClientError(request: TRequest, description: Optional[str] = None, headers: Optional[aioauth.collections.HTTPHeaderDict] = 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: http.HTTPStatus = 401ΒΆ
exception InsecureTransportError(request: TRequest, description: Optional[str] = None, headers: Optional[aioauth.collections.HTTPHeaderDict] = 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: Optional[str] = None, headers: Optional[aioauth.collections.HTTPHeaderDict] = 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: Optional[str] = None, headers: Optional[aioauth.collections.HTTPHeaderDict] = 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: Optional[str] = None, headers: Optional[aioauth.collections.HTTPHeaderDict] = 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: Optional[str] = None, headers: Optional[aioauth.collections.HTTPHeaderDict] = 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: Literal[mismatching_state] = 'mismatching_state'ΒΆ
exception UnauthorizedClientError(request: TRequest, description: Optional[str] = None, headers: Optional[aioauth.collections.HTTPHeaderDict] = 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: Optional[str] = None, headers: Optional[aioauth.collections.HTTPHeaderDict] = 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: Optional[str] = None, headers: Optional[aioauth.collections.HTTPHeaderDict] = 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: Optional[str] = None, headers: Optional[aioauth.collections.HTTPHeaderDict] = 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: Optional[str] = None, headers: Optional[aioauth.collections.HTTPHeaderDict] = 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: Optional[str] = None, headers: Optional[aioauth.collections.HTTPHeaderDict] = 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'ΒΆ