From 28db22b7ac0b5603916c6f5440f18ff5eccc7178 Mon Sep 17 00:00:00 2001 From: legonzaur Date: Mon, 13 May 2024 17:28:09 +0200 Subject: [PATCH] Fix crash when discord oauth2 answer is invalid --- src/controller/auth.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/controller/auth.py b/src/controller/auth.py index 98196a6..f985c35 100644 --- a/src/controller/auth.py +++ b/src/controller/auth.py @@ -22,7 +22,8 @@ def discord_process_code(code: str) -> dict | None: if "error" in json_data: print(json_data) return None - + if (not "token_type" in json_data) or (not "access_token" in json_data): + return None token_type = json_data["token_type"] access_token = json_data["access_token"]