mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Merge pull request #53 from Hestia-Homes/main
Put back in validate_token that was foolishly dropped
This commit is contained in:
commit
ea89340bde
1 changed files with 9 additions and 0 deletions
|
|
@ -94,3 +94,12 @@ def validate_jwt_token(token: str = Depends(oauth2_scheme)):
|
|||
except JWTError:
|
||||
logger.error("An error occurred while decoding the JWT token.")
|
||||
raise credentials_exception
|
||||
|
||||
|
||||
async def validate_token(token: str = Depends(oauth2_scheme), request: Request = None):
|
||||
token_data = validate_jwt_token(token)
|
||||
if not token_data:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_403_FORBIDDEN, detail="Could not validate credentials"
|
||||
)
|
||||
return token
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue