From 4042a49896b0f6d321d039e94e5dc4f7c162aeb7 Mon Sep 17 00:00:00 2001 From: tanshu Date: Fri, 4 Dec 2020 14:50:11 +0530 Subject: [PATCH] Fix: was storing the client id instead of code in the cookie --- brewman/brewman/routers/login.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/brewman/brewman/routers/login.py b/brewman/brewman/routers/login.py index 42ccb9fe..c05b881e 100644 --- a/brewman/brewman/routers/login.py +++ b/brewman/brewman/routers/login.py @@ -68,14 +68,14 @@ async def login_for_access_token( ) ) db.commit() - response.set_cookie(key="client_id", value=str(client.id), max_age=10 * 365 * 24 * 60 * 60) + response.set_cookie(key="client_id", value=str(client.code), max_age=10 * 365 * 24 * 60 * 60) if not allowed: not_allowed_response = JSONResponse( status_code=status.HTTP_401_UNAUTHORIZED, headers={"WWW-Authenticate": "Bearer"}, content={"detail": "Client is not registered"}, ) - not_allowed_response.set_cookie(key="client_id", value=str(client.id), max_age=10 * 365 * 24 * 60 * 60) + not_allowed_response.set_cookie(key="client_id", value=str(client.code), max_age=10 * 365 * 24 * 60 * 60) return not_allowed_response access_token_expires = timedelta(minutes=settings.JWT_TOKEN_EXPIRE_MINUTES) access_token = create_access_token(