Skip to content

Commit f273517

Browse files
davidkl97xuanyang15
authored andcommitted
fix(oauth): add client id to token exchange
Merge #2805 fixes #2806 add client id to token request, adhering to [RFC 6749](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.3) Co-authored-by: Xuan Yang <xygoogle@google.com> COPYBARA_INTEGRATE_REVIEW=#2805 from davidkl97:fix/oauth-exchange-token 3366dce PiperOrigin-RevId: 840369113
1 parent 2b64715 commit f273517

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/google/adk/auth/exchanger/oauth2_credential_exchanger.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ async def _exchange_authorization_code(
196196
),
197197
code=auth_credential.oauth2.auth_code,
198198
grant_type=OAuthGrantType.AUTHORIZATION_CODE,
199+
client_id=auth_credential.oauth2.client_id,
199200
)
200201
update_credential_with_tokens(auth_credential, tokens)
201202
logger.debug("Successfully exchanged authorization code for access token")

tests/unittests/auth/exchanger/test_oauth2_credential_exchanger.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ async def test_exchange_normalize_uri(self, mock_oauth2_session):
341341
authorization_response="https://example.com/callback?code=auth_code", # Normalized URI
342342
code="auth_code",
343343
grant_type=OAuthGrantType.AUTHORIZATION_CODE,
344+
client_id="test_client_id",
344345
)
345346

346347
@pytest.mark.asyncio

0 commit comments

Comments
 (0)