aboutsummaryrefslogtreecommitdiffstats
path: root/backend/routes/auth/authorize.py
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2021-03-06 22:48:19 +0300
committerGravatar Hassan Abouelela <[email protected]>2021-03-06 22:48:19 +0300
commitca730082b523e62595687843a914adad8dbbaccf (patch)
tree351bfbbf4aff36d95560ad66103f358da9d8d7f6 /backend/routes/auth/authorize.py
parentRenames Token To `token` (diff)
Formats Authorize File
Cleans up the authorize file, and the __init__ to maintain the project's code style. Co-authored-by: Joe Banks <[email protected]> Signed-off-by: Hassan Abouelela <[email protected]>
Diffstat (limited to 'backend/routes/auth/authorize.py')
-rw-r--r--backend/routes/auth/authorize.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/backend/routes/auth/authorize.py b/backend/routes/auth/authorize.py
index 98f9887..26d8622 100644
--- a/backend/routes/auth/authorize.py
+++ b/backend/routes/auth/authorize.py
@@ -21,6 +21,8 @@ from backend.discord import fetch_bearer_token, fetch_user_details
from backend.route import Route
from backend.validation import ErrorMessage, api
+AUTH_FAILURE = JSONResponse({"error": "auth_failure"}, status_code=400)
+
class AuthorizeRequest(BaseModel):
token: str = Field(description="The access token received from Discord.")
@@ -31,9 +33,6 @@ class AuthorizeResponse(BaseModel):
expiry: str = Field("ISO formatted timestamp of expiry.")
-AUTH_FAILURE = JSONResponse({"error": "auth_failure"}, status_code=400)
-
-
async def process_token(bearer_token: dict) -> Union[AuthorizeResponse, AUTH_FAILURE]:
"""Post a bearer token to Discord, and return a JWT and username."""
interaction_start = datetime.datetime.now()