From 0c406e893a2a23184dc498ac608e742fa6b691d6 Mon Sep 17 00:00:00 2001 From: "Etienne Scholly, Ph.D" Date: Thu, 24 Oct 2024 18:13:28 +0200 Subject: [PATCH] Add authv2 token handling --- toolbox/api/datagalaxy_api.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/toolbox/api/datagalaxy_api.py b/toolbox/api/datagalaxy_api.py index 86580ae..e2c6793 100644 --- a/toolbox/api/datagalaxy_api.py +++ b/toolbox/api/datagalaxy_api.py @@ -20,7 +20,15 @@ def get_client_space_id(self) -> str: options={"verify_signature": False}, algorithms=["HS256"] ) - client_space_id = decode_token["cid"] + # old auth + if "cid" in decode_token: + client_space_id = decode_token["cid"] + # authv2 + elif "dg_client_id" in decode_token: + client_space_id = decode_token["dg_client_id"] + else: + raise Exception('Error while decoding the token') + return client_space_id