Skip to content
Open
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
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ six >= 1.10
python_dateutil >= 2.5.3
setuptools >= 21.0.0
urllib3 >= 1.15.1
pyjwt >= 2.1.0
7 changes: 7 additions & 0 deletions tb_rest_client/rest_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# limitations under the License.
#

import jwt
from json import dumps
from time import time, sleep
from typing import List

Expand Down Expand Up @@ -85,6 +87,11 @@ def login(self, username, password):
token = None
if isinstance(token_json, dict) and token_json.get("token") is not None:
token = token_json["token"]
self.token_info["token"] = token
# get token - signature verification is not needed
parsed_token = jwt.decode(token, options={"verify_signature": False})
self.token_info["refreshToken"] = parsed_token['exp']

self.configuration.api_key_prefix["X-Authorization"] = "Bearer"
self.configuration.api_key["X-Authorization"] = token

Expand Down