Skip to content

Commit 4d16468

Browse files
authored
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.
1 parent f53bc71 commit 4d16468

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fastapi_sso/sso/gitlab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async def openid_from_response(self, response: dict, session: Optional["httpx.As
2626
return OpenID(
2727
email=response["email"],
2828
provider=self.provider,
29-
id=response["id"],
29+
id=str(response["id"]),
3030
display_name=response["username"],
3131
picture=response["avatar_url"],
3232
)

0 commit comments

Comments
 (0)