diff --git a/api/auth.py b/api/auth.py index f13eda3..d5db292 100644 --- a/api/auth.py +++ b/api/auth.py @@ -17,5 +17,5 @@ def verify_token(token): try: jwt.decode(token, os.getenv('SECRET_KEY'), algorithms=["HS256"]) return True - except: + except jwt.PyJWTError: return False diff --git a/api/helper_functions.py b/api/helper_functions.py index 6eca7a5..3bb74ee 100644 --- a/api/helper_functions.py +++ b/api/helper_functions.py @@ -32,7 +32,7 @@ def extract_token_data(token): if token is not None: try: return jwt.decode(token, os.getenv('SECRET_KEY'), algorithms=["HS256"]) - except: + except jwt.PyJWTError: return None else: return None @@ -52,13 +52,13 @@ def get_email_from_token_data(): return email else: return None - except: + except jwt.PyJWTError: return None else: # "Normal" token, extract username from token try: return jwt.decode(token, os.getenv('SECRET_KEY'), algorithms=["HS256"])['email'] - except: + except jwt.PyJWTError: return None return None