Skip to content

Commit ac27d94

Browse files
SNOW-2229745: Move oauth_type into client_environment (#2453)
1 parent 6d2c0c0 commit ac27d94

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

DESCRIPTION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Source code is also available at: https://github.com/snowflakedb/snowflake-conne
1717
- Add `unsafe_skip_file_permissions_check` flag to skip file permissions check on cache and config.
1818
- Introduce snowflake_version property to the connection
1919
- Added basic json support for Interval types.
20+
- Moved `OAUTH_TYPE` to `CLIENT_ENVIROMENT`.
2021

2122
- v3.16.0(July 04,2025)
2223
- Bumped numpy dependency from <2.1.0 to <=2.2.4.

src/snowflake/connector/auth/_oauth_base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,9 @@ def update_body(self, body: dict[Any, Any]) -> None:
270270
"""
271271
body["data"]["AUTHENTICATOR"] = OAUTH_AUTHENTICATOR
272272
body["data"]["TOKEN"] = self._access_token
273-
body["data"]["OAUTH_TYPE"] = self._get_oauth_type_id()
273+
if "CLIENT_ENVIRONMENT" not in body["data"]:
274+
body["data"]["CLIENT_ENVIRONMENT"] = {}
275+
body["data"]["CLIENT_ENVIRONMENT"]["OAUTH_TYPE"] = self._get_oauth_type_id()
274276

275277
def _do_refresh_token(self, conn: SnowflakeConnection) -> None:
276278
"""If a refresh token is available exchanges it with a new access token.

test/unit/test_auth_oauth_auth_code.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ def test_auth_oauth_auth_code_oauth_type(omit_oauth_urls_check):
3939
)
4040
body = {"data": {}}
4141
auth.update_body(body)
42-
assert body["data"]["OAUTH_TYPE"] == "oauth_authorization_code"
42+
assert (
43+
body["data"]["CLIENT_ENVIRONMENT"]["OAUTH_TYPE"] == "oauth_authorization_code"
44+
)
4345

4446

4547
@pytest.mark.parametrize("rtr_enabled", [True, False])

test/unit/test_oauth_token.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,9 @@ def test_client_creds_oauth_type():
551551
)
552552
body = {"data": {}}
553553
auth.update_body(body)
554-
assert body["data"]["OAUTH_TYPE"] == "oauth_client_credentials"
554+
assert (
555+
body["data"]["CLIENT_ENVIRONMENT"]["OAUTH_TYPE"] == "oauth_client_credentials"
556+
)
555557

556558

557559
@pytest.mark.skipolddriver

0 commit comments

Comments
 (0)