Skip to content

Commit

Permalink
Merge pull request #15 from TebogoYungMercykay/feature_01
Browse files Browse the repository at this point in the history
The Python FastAPI Implementation Files
  • Loading branch information
TebogoYungMercykay authored Dec 22, 2023
2 parents bfab454 + 579cad2 commit 5b9a394
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ def create_access_token(data: dict):
def verify_access_token(token: str, credentials_exception):

try:

# print(SECRET_KEY, credentials_exception)
payload = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])
id: str = payload.get("user_id")
if id is None:
user_id: str = payload.get("user_id")
if user_id is None:
raise credentials_exception
token_data = schemas.TokenData(id=id)
user_id = str(user_id)
token_data = schemas.TokenData(id=user_id)
except JWTError:
raise credentials_exception

Expand Down

0 comments on commit 5b9a394

Please sign in to comment.