fix jwt token decoding; correctly import google auth routes; adjust app/auth/ package
This commit is contained in:
+3
-3
@@ -1,6 +1,6 @@
|
||||
from fastapi import Request, HTTPException
|
||||
import os
|
||||
from . import jwt
|
||||
from .jwt import decode_token
|
||||
|
||||
JWT_SECRET = os.getenv("JWT_SECRET")
|
||||
JWT_ALGORITHM = os.getenv("JWT_ALGORITHM", "HS256")
|
||||
@@ -13,7 +13,7 @@ def get_current_user(request: Request):
|
||||
raise HTTPException(status_code=401, detail="Not authenticated")
|
||||
|
||||
try:
|
||||
payload = jwt.decode(token, JWT_SECRET, algorithms=[JWT_ALGORITHM])
|
||||
return payload["user_id"]
|
||||
payload = decode_token(token, JWT_SECRET, algorithms=[JWT_ALGORITHM])
|
||||
return payload["sub"]
|
||||
except:
|
||||
raise HTTPException(status_code=401, detail="Invalid token")
|
||||
Reference in New Issue
Block a user