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. "
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. "