LoginFailedError on 414 (UriTooLong) with AuthTokenAuthenticator
Summary
When using an AuthToken (configure_connection(password_method="auth_token", auth_token=auth_token)
) authenticator and triggering an UriTooLong HTTP error (by retrieving many entities), the auththenticator raises a LoginFailedError even though the session token is still valid.
Expected Behavior
No error.
Actual Behavior
caosdb.exceptions.LoginFailedError: The authentication token is expired or you have been logged out otherwise. The auth_token authenticator cannot log in again. You must provide a new authentication token.
Steps to Reproduce the Problem
>>> db.Info() # via any authentication method (e.g. plain password)
Connection to CaosDB with 3004 Records.
>>> auth_token = db.get_connection()._authenticator.auth_token # or generate a one-time token
>>> db.configure_connection(auth_token=auth_token)
>>> c = db.Container()
>>> c.extend([db.Record(id=i) for i in range(1000,5000)])
>>> c.retrieve()
Traceback (most recent call last):
File "/home/tf/src/caosdb-pyinttest/.env/lib64/python3.11/site-packages/caosdb/connection/connection.py", line 662, in _http_request
return self._retry_http_request(method=method, path=path,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tf/src/caosdb-pyinttest/.env/lib64/python3.11/site-packages/caosdb/connection/connection.py", line 691, in _retry_http_request
self._authenticator.on_request(method=method, path=path,
File "/home/tf/src/caosdb-pyinttest/.env/lib64/python3.11/site-packages/caosdb/connection/authentication/interface.py", line 150, in on_request
self.login()
File "/home/tf/src/caosdb-pyinttest/.env/lib64/python3.11/site-packages/caosdb/connection/authentication/auth_token.py", line 68, in login
self._login()
File "/home/tf/src/caosdb-pyinttest/.env/lib64/python3.11/site-packages/caosdb/connection/authentication/auth_token.py", line 71, in _login
raise LoginFailedError("The authentication token is expired or you "
caosdb.exceptions.LoginFailedError: The authentication token is expired or you have been logged out otherwise. The auth_token authenticator cannot log in again. You must provide a new authentication token.
[...]
This also affects c.delete()
Specifications
-
=pylib 0.10.0 (but probably earlier versions are affected as well
Work-Around
- Split up the container into chunks before retrieval (unacceptable for most users/use-cases)