Skip to content

Commit

Permalink
Update auth.py
Browse files Browse the repository at this point in the history
  • Loading branch information
beasteers authored Dec 16, 2023
1 parent d605785 commit 5ee5c2e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ async def require_authorization(token: str = Depends(oauth2)):
payload = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM], options={'verify_exp': False})
username: str = payload.get("sub")
if username is None:
raise tokenError
return User(username='anon')
#raise tokenError
except JWTError:
raise tokenError
return User(username='anon')
#raise tokenError
return User(username=username)

0 comments on commit 5ee5c2e

Please sign in to comment.