Skip to content

Commit

Permalink
Fix GitLab OpenID instance as it breaks with latest pydantic (#143)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chrisK824 authored Apr 1, 2024
1 parent f53bc71 commit 4d16468
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fastapi_sso/sso/gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
)

0 comments on commit 4d16468

Please sign in to comment.