Skip to content

fix(types): allow user_id to accept int values in UserIdentitySchema#828

Open
armorbreak001 wants to merge 1 commit intoauth0:masterfrom
armorbreak001:fix/user-id-int-allow
Open

fix(types): allow user_id to accept int values in UserIdentitySchema#828
armorbreak001 wants to merge 1 commit intoauth0:masterfrom
armorbreak001:fix/user-id-int-allow

Conversation

@armorbreak001
Copy link
Copy Markdown

Description

GitHub (and possibly other social) identity providers return user_id as an integer in the identities array. The current Optional[str] typing causes a Pydantic validation error when calling users.get() for accounts linked with such providers:

1 validation error for GetUserResponseContent
identities.0.user_id
  Input should be a valid string [type=string_type, input_value=123456789, input_type=int]

Changes

Relax the user_id field type from Optional[str] to Optional[Union[str, int]] to match actual API behavior where the value can be either a string or an integer depending on the identity provider.

Fixes #826

GitHub identity providers (and possibly others) return user_id as an
integer rather than a string. The current Optional[str] typing causes
Pydantic validation errors when calling users.get() for such accounts.

Relax the type to Union[str, int] to match the actual API behavior.

Fixes auth0#826
@armorbreak001 armorbreak001 requested a review from a team as a code owner April 22, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pydantic validation error when calling user.get

1 participant