[GH-ISSUE #617] "Input should be a valid string" when using LDAP #484

Open
opened 2026-02-25 21:32:01 +03:00 by kerem · 0 comments
Owner

Originally created by @Elbullazul on GitHub (Jun 10, 2024).
Original GitHub issue: https://github.com/ciur/papermerge/issues/617

Originally assigned to: @ciur on GitHub.

Description
When logging in with an LDAP user, I get the following error:

pydantic_core._pydantic_core.ValidationError: 1 validation error for Token
  access_token
    Input should be a valid string [type=string_type, input_value=<auth_server.db.models.Us...bject at 0x7f1ffef023b0>, input_type=User]
      For further information visit https://errors.pydantic.dev/2.5/v/string_type

and I can't log in.

Info:

  • Papermerge Version: 3.2
  • LDAP server: LLDAP
  • Logs
INFO 2024-06-10 10:14:49,564 users User with email username@provider.com is None
172.16.4.3 - - [10/Jun/2024:10:14:49 +0000] "POST /api/token HTTP/1.1" 500 21 "https://papermerge.domain.example/" "Mozilla/5.0 (X11; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0"
Exception in ASGI application
Traceback (most recent call last):
  File "/auth_server_app/.venv/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 428, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/auth_server_app/.venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "/auth_server_app/.venv/lib/python3.10/site-packages/uvicorn/middleware/message_logger.py", line 86, in __call__
    raise exc from None
  File "/auth_server_app/.venv/lib/python3.10/site-packages/uvicorn/middleware/message_logger.py", line 82, in __call__
    await self.app(scope, inner_receive, inner_send)
  File "/auth_server_app/.venv/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/auth_server_app/.venv/lib/python3.10/site-packages/starlette/applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/auth_server_app/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/auth_server_app/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/auth_server_app/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/auth_server_app/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/auth_server_app/.venv/lib/python3.10/site-packages/starlette/routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "/auth_server_app/.venv/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "/auth_server_app/.venv/lib/python3.10/site-packages/starlette/routing.py", line 66, in app
    response = await func(request)
  File "/auth_server_app/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 299, in app
    raise e
  File "/auth_server_app/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 294, in app
    raw_response = await run_endpoint_function(
  File "/auth_server_app/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
  File "/auth_server_app/auth_server/main.py", line 71, in token_endpoint
    return schemas.Token(access_token=access_token)
  File "/auth_server_app/.venv/lib/python3.10/site-packages/pydantic/main.py", line 164, in __init__
    __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)
pydantic_core._pydantic_core.ValidationError: 1 validation error for Token
access_token
  Input should be a valid string [type=string_type, input_value=<auth_server.db.models.Us...bject at 0x7f1ffef023b0>, input_type=User]
    For further information visit https://errors.pydantic.dev/2.5/v/string_type
Originally created by @Elbullazul on GitHub (Jun 10, 2024). Original GitHub issue: https://github.com/ciur/papermerge/issues/617 Originally assigned to: @ciur on GitHub. **Description** When logging in with an LDAP user, I get the following error: ```python pydantic_core._pydantic_core.ValidationError: 1 validation error for Token access_token Input should be a valid string [type=string_type, input_value=<auth_server.db.models.Us...bject at 0x7f1ffef023b0>, input_type=User] For further information visit https://errors.pydantic.dev/2.5/v/string_type ``` and I can't log in. **Info:** - Papermerge Version: 3.2 - LDAP server: [LLDAP](https://github.com/lldap/lldap) - Logs ```python INFO 2024-06-10 10:14:49,564 users User with email username@provider.com is None 172.16.4.3 - - [10/Jun/2024:10:14:49 +0000] "POST /api/token HTTP/1.1" 500 21 "https://papermerge.domain.example/" "Mozilla/5.0 (X11; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0" Exception in ASGI application Traceback (most recent call last): File "/auth_server_app/.venv/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 428, in run_asgi result = await app( # type: ignore[func-returns-value] File "/auth_server_app/.venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__ return await self.app(scope, receive, send) File "/auth_server_app/.venv/lib/python3.10/site-packages/uvicorn/middleware/message_logger.py", line 86, in __call__ raise exc from None File "/auth_server_app/.venv/lib/python3.10/site-packages/uvicorn/middleware/message_logger.py", line 82, in __call__ await self.app(scope, inner_receive, inner_send) File "/auth_server_app/.venv/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in __call__ await super().__call__(scope, receive, send) File "/auth_server_app/.venv/lib/python3.10/site-packages/starlette/applications.py", line 122, in __call__ await self.middleware_stack(scope, receive, send) File "/auth_server_app/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__ raise exc File "/auth_server_app/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__ await self.app(scope, receive, _send) File "/auth_server_app/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__ raise exc File "/auth_server_app/.venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__ await self.app(scope, receive, sender) File "/auth_server_app/.venv/lib/python3.10/site-packages/starlette/routing.py", line 718, in __call__ await route.handle(scope, receive, send) File "/auth_server_app/.venv/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle await self.app(scope, receive, send) File "/auth_server_app/.venv/lib/python3.10/site-packages/starlette/routing.py", line 66, in app response = await func(request) File "/auth_server_app/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 299, in app raise e File "/auth_server_app/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 294, in app raw_response = await run_endpoint_function( File "/auth_server_app/.venv/lib/python3.10/site-packages/fastapi/routing.py", line 191, in run_endpoint_function return await dependant.call(**values) File "/auth_server_app/auth_server/main.py", line 71, in token_endpoint return schemas.Token(access_token=access_token) File "/auth_server_app/.venv/lib/python3.10/site-packages/pydantic/main.py", line 164, in __init__ __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__) pydantic_core._pydantic_core.ValidationError: 1 validation error for Token access_token Input should be a valid string [type=string_type, input_value=<auth_server.db.models.Us...bject at 0x7f1ffef023b0>, input_type=User] For further information visit https://errors.pydantic.dev/2.5/v/string_type ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/papermerge#484
No description provided.