From 2351f266667372646939d389b390657851eb0a7c Mon Sep 17 00:00:00 2001 From: Pauline Ribeyre <4224001+paulineribeyre@users.noreply.github.com> Date: Tue, 7 Apr 2026 16:52:24 -0500 Subject: [PATCH 1/2] get_access_token_with_key endpoint param --- gen3/auth.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gen3/auth.py b/gen3/auth.py index 3e02ee8a..7a102d80 100755 --- a/gen3/auth.py +++ b/gen3/auth.py @@ -65,11 +65,11 @@ def _handle_access_token_response(resp, token_key): raise Gen3AuthError(err_msg.format(resp.url, json_resp)) -def get_access_token_with_key(api_key): +def get_access_token_with_key(api_key, endpoint=None): """ Try to fetch an access token given the api key """ - endpoint = endpoint_from_token(api_key["api_key"]) + endpoint = endpoint or endpoint_from_token(api_key["api_key"]) # attempt to get a token from Fence auth_url = "{}/user/credentials/cdis/access_token".format(endpoint) resp = requests.post(auth_url, json=api_key) @@ -368,7 +368,9 @@ def refresh_access_token(self, endpoint=None): endpoint, self._client_credentials, self._client_scopes ) elif self._refresh_token: - self._access_token = get_access_token_with_key(self._refresh_token) + self._access_token = get_access_token_with_key( + self._refresh_token, endpoint + ) else: logging.warning( f"Unable to refresh access token. " From 56fe5743b28558ff8e417d743095a408c67051fe Mon Sep 17 00:00:00 2001 From: paulineribeyre Date: Tue, 7 Apr 2026 21:53:38 +0000 Subject: [PATCH 2/2] Apply automatic documentation changes --- docs/_build/html/_modules/gen3/auth.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/_build/html/_modules/gen3/auth.html b/docs/_build/html/_modules/gen3/auth.html index a6d77d0e..855bf011 100644 --- a/docs/_build/html/_modules/gen3/auth.html +++ b/docs/_build/html/_modules/gen3/auth.html @@ -98,11 +98,11 @@

Source code for gen3.auth

         raise Gen3AuthError(err_msg.format(resp.url, json_resp))
 
 
-def get_access_token_with_key(api_key):
+def get_access_token_with_key(api_key, endpoint=None):
     """
     Try to fetch an access token given the api key
     """
-    endpoint = endpoint_from_token(api_key["api_key"])
+    endpoint = endpoint or endpoint_from_token(api_key["api_key"])
     # attempt to get a token from Fence
     auth_url = "{}/user/credentials/cdis/access_token".format(endpoint)
     resp = requests.post(auth_url, json=api_key)
@@ -405,7 +405,9 @@ 

Source code for gen3.auth

                 endpoint, self._client_credentials, self._client_scopes
             )
         elif self._refresh_token:
-            self._access_token = get_access_token_with_key(self._refresh_token)
+            self._access_token = get_access_token_with_key(
+                self._refresh_token, endpoint
+            )
         else:
             logging.warning(
                 f"Unable to refresh access token. "