From 9c0590ba93bc3bc43824842afc2ddbaff080ae63 Mon Sep 17 00:00:00 2001 From: Key Date: Mon, 15 Jan 2024 10:59:21 -0500 Subject: [PATCH] add logic to define is_sandbox based on base_uri --- target_salesforce_v3/auth.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/target_salesforce_v3/auth.py b/target_salesforce_v3/auth.py index f03d857..086bc91 100644 --- a/target_salesforce_v3/auth.py +++ b/target_salesforce_v3/auth.py @@ -104,7 +104,14 @@ def update_access_token(self) -> None: return auth_request_payload = self.oauth_request_payload headers = {"Content-Type": "application/x-www-form-urlencoded"} - if self._target._config.get("is_sandbox"): + + is_sandbox = ( + self._target._config.get("base_uri") == "https://test.salesforce.com" + if self._target._config.get("base_uri") + else self._target._config.get("is_sandbox") + ) + + if is_sandbox: login_url = 'https://test.salesforce.com/services/oauth2/token' else: login_url = 'https://login.salesforce.com/services/oauth2/token'