diff --git a/api/api/db/logic/auth.py b/api/api/db/logic/auth.py index c7a8be7..6bcdfe5 100644 --- a/api/api/db/logic/auth.py +++ b/api/api/db/logic/auth.py @@ -49,7 +49,7 @@ async def get_user(connection: AsyncConnection, login: str) -> Optional[User]: return user, password -async def upgrade_old_refresh_token(connection: AsyncConnection, user) -> Optional[User]: +async def upgrade_old_refresh_token(connection: AsyncConnection, user,refresh_token) -> Optional[User]: new_status = KeyStatus.EXPIRED @@ -58,7 +58,8 @@ async def upgrade_old_refresh_token(connection: AsyncConnection, user) -> Option .where( account_table.c.id == user.id, account_keyring_table.c.status == KeyStatus.ACTIVE, - account_keyring_table.c.key_type == KeyType.REFRESH_TOKEN + account_keyring_table.c.key_type == KeyType.REFRESH_TOKEN, + account_keyring_table.c.key_value == refresh_token ) .values(status=new_status) ) diff --git a/api/api/endpoints/auth.py b/api/api/endpoints/auth.py index 76e147b..7f60004 100644 --- a/api/api/endpoints/auth.py +++ b/api/api/endpoints/auth.py @@ -129,7 +129,7 @@ async def refresh( except Exception as e: - await upgrade_old_refresh_token(connection,current_user) + await upgrade_old_refresh_token(connection,current_user,refresh_token) raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED,