oauth.py
 1  from fastapi import status
 2  
 3  from .api_exception import APIException
 4  
 5  
 6  class ProviderNotFoundError(APIException):
 7      status_code = status.HTTP_404_NOT_FOUND
 8      detail = "Provider not found"
 9      description = "OAuth provider could not be found."
10  
11  
12  class InvalidOAuthCodeError(APIException):
13      status_code = status.HTTP_401_UNAUTHORIZED
14      detail = "Invalid code"
15      description = "Invalid OAuth authorization code."
16  
17  
18  class InvalidOAuthTokenError(APIException):
19      status_code = status.HTTP_401_UNAUTHORIZED
20      detail = "Invalid OAuth token"
21      description = "Invalid OAuth register token."
22  
23  
24  class RemoteAlreadyLinkedError(APIException):
25      status_code = status.HTTP_409_CONFLICT
26      detail = "Remote already linked"
27      description = "The remote user has already been linked to another account."
28  
29  
30  class ConnectionNotFoundError(APIException):
31      status_code = status.HTTP_404_NOT_FOUND
32      detail = "Connection not found"
33      description = "This OAuth connection does not exist."