From 4d16468a11b8f95e25ebe46e033a84039c6abdb9 Mon Sep 17 00:00:00 2001 From: Chris Karvouniaris Date: Mon, 1 Apr 2024 17:49:31 +0300 Subject: [PATCH] Fix GitLab OpenID instance as it breaks with latest pydantic (#143) Latest versions of Pydantic reject objects that are not created with their values aligned to their hints. This results in GitLab SSO breaking when trying to form the OpenID object, as the response from GitLab comes with an int for the 'id' field while OpenID pydantic model expects a string. Fix is simple and easy with just casting the field to string when creating the object in openid_from_response of GitlabSSO class. --- fastapi_sso/sso/gitlab.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastapi_sso/sso/gitlab.py b/fastapi_sso/sso/gitlab.py index d266869..8044ae8 100644 --- a/fastapi_sso/sso/gitlab.py +++ b/fastapi_sso/sso/gitlab.py @@ -26,7 +26,7 @@ async def openid_from_response(self, response: dict, session: Optional["httpx.As return OpenID( email=response["email"], provider=self.provider, - id=response["id"], + id=str(response["id"]), display_name=response["username"], picture=response["avatar_url"], )