Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.9.27 (2026-01-14)

### Changes

- When a request response is 401 Unauthorized and a JSON Web Token was used for the request, clear the token and retry the request to fetch a new token via basic auth.

## 0.9.26 (2025-12-11)

### Changes
Expand Down
8 changes: 8 additions & 0 deletions python/mujinwebstackclient/controllerwebclientraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,14 @@ def Request(

response = self._session.request(method=method, url=url, timeout=timeout, headers=headers, **kwargs)

# if the response is 401 and JSON web token was used, it is possible that the token has expired
if response.status_code == 401 and isinstance(self._session.auth, JSONWebTokenAuth):
if self._session.auth._jsonWebToken is not None:
log.debug('request %s %s received unauthorized error, clearing cached json web token and retrying', method, url)
# clear the token and retry the request to fetch a new token via basic auth
self._session.auth._jsonWebToken = None
response = self._session.request(method=method, url=url, timeout=timeout, headers=headers, **kwargs)

# in verbose logging, log the caller
if log.isEnabledFor(5): # logging.VERBOSE might not be available in the system
log.verbose('request %s %s response %s took %.03f seconds:\n%s', method, url, response.status_code, response.elapsed.total_seconds(), '\n'.join([line.strip() for line in traceback.format_stack()[:-1]]))
Expand Down
2 changes: 1 addition & 1 deletion python/mujinwebstackclient/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '0.9.26'
__version__ = '0.9.27'

# Do not forget to update CHANGELOG.md