Skip to content

[BUG] got claim acct in type int, but fastapi-azure-auth is waiting for str #180

@copdips

Description

@copdips

With lastest version of FastAPI and Pydantic, When I got an access token from Azure, in the claims, the value for acct is a int to 0, but fastapi-azure-auth is waiting for str, could you please fix that:

https://github.com/Intility/fastapi-azure-auth/blob/52073693e1b59340d1e040b384b957dc61db0fd3/fastapi_azure_auth/user.py#L90

user: User = User(
                        **{**token, 'claims': token, 'access_token': access_token, 'is_guest': user_is_guest}
                    )
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/xxx/.venv/lib/python3.11/site-packages/pydantic/main.py", line 171, in __init__
    self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for User
acct
  Input should be a valid string [type=string_type, input_value=0, input_type=int]
    For further information visit https://errors.pydantic.dev/2.6/v/string_type

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions