diff --git a/mssql_python/auth.py b/mssql_python/auth.py index b117c171..c7e6683a 100644 --- a/mssql_python/auth.py +++ b/mssql_python/auth.py @@ -84,10 +84,11 @@ def process_auth_parameters(parameters: list) -> Tuple[list, Optional[str]]: if key_lower == "authentication": # Check for supported authentication types and set auth_type accordingly if value_lower == AuthType.INTERACTIVE.value: + auth_type = "interactive" # Interactive authentication (browser-based); only append parameter for non-Windows if platform.system().lower() == "windows": - continue # Skip adding this parameter for Windows - auth_type = "interactive" + auth_type = None # Let Windows handle AADInteractive natively + elif value_lower == AuthType.DEVICE_CODE.value: # Device code authentication (for devices without browser) auth_type = "devicecode" diff --git a/tests/test_008_auth.py b/tests/test_008_auth.py index 2c3c1a0a..6bf6c410 100644 --- a/tests/test_008_auth.py +++ b/tests/test_008_auth.py @@ -137,24 +137,23 @@ def test_interactive_auth_windows(self, monkeypatch): monkeypatch.setattr(platform, "system", lambda: "Windows") params = ["Authentication=ActiveDirectoryInteractive", "Server=test"] modified_params, auth_type = process_auth_parameters(params) - assert "Authentication=ActiveDirectoryInteractive" not in modified_params + assert "Authentication=ActiveDirectoryInteractive" in modified_params assert auth_type == None def test_interactive_auth_non_windows(self, monkeypatch): monkeypatch.setattr(platform, "system", lambda: "Darwin") params = ["Authentication=ActiveDirectoryInteractive", "Server=test"] - modified_params, auth_type = process_auth_parameters(params) - assert "Authentication=ActiveDirectoryInteractive" in modified_params + _, auth_type = process_auth_parameters(params) assert auth_type == "interactive" def test_device_code_auth(self): params = ["Authentication=ActiveDirectoryDeviceCode", "Server=test"] - modified_params, auth_type = process_auth_parameters(params) + _, auth_type = process_auth_parameters(params) assert auth_type == "devicecode" def test_default_auth(self): params = ["Authentication=ActiveDirectoryDefault", "Server=test"] - modified_params, auth_type = process_auth_parameters(params) + _, auth_type = process_auth_parameters(params) assert auth_type == "default" class TestRemoveSensitiveParams: