mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-04-20 05:54:19 +02:00
cleanup code
This commit is contained in:
@@ -61,11 +61,11 @@ async def get_current_user(db: SessionDependency, token: str = Depends(oauth2_sc
|
||||
|
||||
def create_access_token(data: dict, expires_delta: timedelta | None = None):
|
||||
to_encode = data.copy()
|
||||
config = AuthConfig
|
||||
auth_config = AuthConfig
|
||||
if expires_delta:
|
||||
expire = datetime.now(timezone.utc) + expires_delta
|
||||
else:
|
||||
expire = datetime.now(timezone.utc) + timedelta(minutes=config.jwt_access_token_lifetime)
|
||||
expire = datetime.now(timezone.utc) + timedelta(minutes=auth_config.jwt_access_token_lifetime)
|
||||
to_encode.update({"exp": expire})
|
||||
encoded_jwt = jwt.encode(to_encode, config.jwt_signing_key, algorithm=config.jwt_signing_algorithm)
|
||||
encoded_jwt = jwt.encode(to_encode, auth_config.jwt_signing_key, algorithm=auth_config.jwt_signing_algorithm)
|
||||
return encoded_jwt
|
||||
|
||||
Reference in New Issue
Block a user