diff --git a/airflow/providers/tabular/hooks/tabular.py b/airflow/providers/tabular/hooks/tabular.py index 11dbb877d6394..fcf7d85d42e4f 100644 --- a/airflow/providers/tabular/hooks/tabular.py +++ b/airflow/providers/tabular/hooks/tabular.py @@ -68,7 +68,7 @@ def test_connection(self) -> Tuple[bool, str]: self.get_conn() return True, "Successfully fetched token from Tabular" except HTTPError as e: - return False, f"HTTP Error: {e}" + return False, f"HTTP Error: {e}: {e.response.text}" except Exception as e: return False, str(e) @@ -79,10 +79,9 @@ def get_conn(self) -> str: base_url = base_url.rstrip('/') client_id = conn.login client_secret = conn.password - headers = {"Content-Type": "application/x-www-form-urlencoded"} - data = {"client_id": client_id, "client_secret": client_secret} + data = {"client_id": client_id, "client_secret": client_secret, "grant_type": "client_credentials"} - response = requests.post(f"{base_url}/{TOKENS_ENDPOINT}", data=data, headers=headers) + response = requests.post(f"{base_url}/{TOKENS_ENDPOINT}", data=data) response.raise_for_status() return response.json()["access_token"]