Skip to content

Commit a51e975

Browse files
update auth flow
1 parent 038b4f1 commit a51e975

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

google/oauth2/gdch_credentials.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,16 @@ def __init__(
118118
self._quota_project_id = quota_project_id
119119

120120
def _make_k8s_token_request(self, request):
121+
k8s_request_body = {
122+
"kind": "TokenRequest",
123+
"apiVersion": "authentication.k8s.io/v1",
124+
"spec": {"audiences": [self._ais_token_endpoint]},
125+
}
121126
# mTLS connection to k8s token endpoint to get a k8s token.
122127
k8s_response_data = _client._token_endpoint_request(
123128
request,
124129
self._k8s_token_endpoint,
125-
{},
130+
k8s_request_body,
126131
None,
127132
True,
128133
http_client.CREATED,

tests/oauth2/test_gdch_credentials.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ def test__make_k8s_token_request(self, token_endpoint_request):
7575
token_endpoint_request.assert_called_with(
7676
req,
7777
creds._k8s_token_endpoint,
78-
{},
78+
{
79+
"kind": "TokenRequest",
80+
"apiVersion": "authentication.k8s.io/v1",
81+
"spec": {"audiences": [creds._ais_token_endpoint]},
82+
},
7983
None,
8084
True,
8185
http_client.CREATED,

0 commit comments

Comments
 (0)