From fec8f8db31474c7392579037b0b9580f34226515 Mon Sep 17 00:00:00 2001 From: Benjamin Bolte Date: Wed, 24 Jul 2024 22:34:08 -0700 Subject: [PATCH] different error message... --- store/app/routers/auth/github.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/store/app/routers/auth/github.py b/store/app/routers/auth/github.py index 67017526..364783c3 100644 --- a/store/app/routers/auth/github.py +++ b/store/app/routers/auth/github.py @@ -73,8 +73,10 @@ async def github_code( headers = {"Accept": "application/json"} oauth_response = await github_access_token_req(params, headers) - if not oauth_response.is_success or "error" in (response_json := oauth_response.json()): + if not oauth_response.is_success: raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="Github authentication failed") + if "access_token" not in (response_json := oauth_response.json()): + raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="Token not found in response from Github") # access token is used to retrieve user oauth details access_token = response_json["access_token"]