revoke access_tokens
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user