From 315dbc72f8fba6f052d187c55d70dfe6815ed04d Mon Sep 17 00:00:00 2001 From: Vallari Agrawal Date: Mon, 21 Aug 2023 16:00:12 +0530 Subject: [PATCH] login: add error handling for missing env variable Signed-off-by: Vallari Agrawal --- src/routes/login.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/routes/login.py b/src/routes/login.py index e803c7a..c4916a2 100644 --- a/src/routes/login.py +++ b/src/routes/login.py @@ -28,6 +28,8 @@ async def github_login(): GET route for /login, (If first time) will redirect to github login page where you should authorize the app to gain access. """ + if not GH_AUTHORIZATION_BASE_URL or not GH_CLIENT_ID: + return HTTPException(status_code=500, detail="Environment secrets are missing.") scope = "read:org" return RedirectResponse( f"{GH_AUTHORIZATION_BASE_URL}?client_id={GH_CLIENT_ID}&scope={scope}",