From 4f3e38413754599bb9dd9946ac8376dc36462fdf Mon Sep 17 00:00:00 2001 From: "ran.liao" Date: Fri, 6 Dec 2024 16:38:14 +0900 Subject: [PATCH] Remove basic auth if token is available --- python/mujinwebstackclient/controllerwebclientraw.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/mujinwebstackclient/controllerwebclientraw.py b/python/mujinwebstackclient/controllerwebclientraw.py index 468ae79..69b9aac 100644 --- a/python/mujinwebstackclient/controllerwebclientraw.py +++ b/python/mujinwebstackclient/controllerwebclientraw.py @@ -259,8 +259,8 @@ def CallGraphAPI(self, query, variables=None, headers=None, timeout=5.0): def UpdateJsonWebToken(self, jsonWebToken): if jsonWebToken == '': - self._session.auth = None - self._headers['Authorization'] = 'Bearer ' + jsonWebToken - else: self._session.auth = requests_auth.HTTPBasicAuth(self._username, self._password) self._headers.pop('Authorization', None) + else: + self._session.auth = None + self._headers['Authorization'] = 'Bearer ' + jsonWebToken