Skip to content

Commit 5b9a394

Browse files
Merge pull request #15 from TebogoYungMercykay/feature_01
The Python FastAPI Implementation Files
2 parents bfab454 + 579cad2 commit 5b9a394

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

app/oauth2.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ def create_access_token(data: dict):
2727
def verify_access_token(token: str, credentials_exception):
2828

2929
try:
30-
30+
# print(SECRET_KEY, credentials_exception)
3131
payload = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])
32-
id: str = payload.get("user_id")
33-
if id is None:
32+
user_id: str = payload.get("user_id")
33+
if user_id is None:
3434
raise credentials_exception
35-
token_data = schemas.TokenData(id=id)
35+
user_id = str(user_id)
36+
token_data = schemas.TokenData(id=user_id)
3637
except JWTError:
3738
raise credentials_exception
3839

0 commit comments

Comments
 (0)