From 0542e2d69239698a72afd61872d6e23d8c78ed26 Mon Sep 17 00:00:00 2001 From: F-G Fernandez <26927750+frgfm@users.noreply.github.com> Date: Fri, 1 Mar 2024 13:25:37 +0100 Subject: [PATCH] fix(login): revert provider user ID format (#112) --- src/app/api/api_v1/endpoints/login.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/api/api_v1/endpoints/login.py b/src/app/api/api_v1/endpoints/login.py index 6b5ba06..1d30e05 100644 --- a/src/app/api/api_v1/endpoints/login.py +++ b/src/app/api/api_v1/endpoints/login.py @@ -14,7 +14,7 @@ from app.core.config import settings from app.core.security import create_access_token, verify_password from app.crud import UserCRUD -from app.models import Provider, UserScope +from app.models import UserScope from app.schemas.login import GHAccessToken, Token, TokenRequest from app.schemas.services import GHToken from app.schemas.users import UserCreate @@ -85,7 +85,7 @@ async def login_with_github_token( if gh_user["type"] != "User": raise HTTPException(status.HTTP_401_UNAUTHORIZED, "GitHub account is expected to be a user") # Verify credentials - user = await users.get_by("provider_user_id", f"{Provider.GITHUB}|{gh_user['id']}", strict=False) + user = await users.get_by("provider_user_id", gh_user["id"], strict=False) # Register if non existing if user is None: user = await _create_user(UserCreate(provider_user_id=gh_user["id"], scope=UserScope.USER), users) # type: ignore[call-arg]