revoke access_tokens

This commit is contained in:
2026-09-05 20:26:42 +03:00
parent da8284ae64
commit c4a6a88d05
4 changed files with 34 additions and 10 deletions
+4 -1
View File
@@ -35,14 +35,17 @@ class JwtService:
if not (data.get("sub")) or data.get("sub") == "":
raise self.error.credentials_error(detail="Jwt token is incorrect")
async def create_access_token(self, data:dict)->str:
user_info=data.copy()
jti=str(uuid4())
await self._validate_sub(user_info)
user_info.update({"exp": datetime.now(UTC)+timedelta(minutes=env_settings.ACCESS_TOKEN_EXPIRE_MINUTES),
"token_type":"access"})
"token_type":"access",
"jti":jti})
return jwt.encode(user_info, env_settings.SECRET_KEY, env_settings.ALGORITHM)