OAuth with PKCE Authentication for OpenApiToolset #4592
Replies: 5 comments 2 replies
-
|
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: Based on the current ADK documentation and source code, there is no direct, out-of-the-box support for passing a Hi @skullboy-1614, Thanks for reaching out. I've looked into your question about using OAuth with PKCE in the The standard authentication setup for After reviewing the ADK source code, the configuration classes used by While the OpenAPI 3.0 specification itself supports defining PKCE, the current implementation of As a potential workaround, you could consider creating a custom I hope this information is helpful. This seems like a valuable feature, and you may want to consider opening a feature request in the repository for direct PKCE support in [1] https://google.github.io/adk-docs/tools-custom/authentication/ |
Beta Was this translation helpful? Give feedback.
-
|
Hi @adk-bot can I monkey patch the method to include code verifier? |
Beta Was this translation helpful? Give feedback.
-
|
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: Based on the available documentation, there is no explicit, built-in support for the OAuth 2.0 PKCE flow (i.e., passing a Hi @skullboy-1614, Thanks for your question. I've looked into the documentation for The standard method for configuring OAuth2 authentication involves defining an However, after reviewing the documentation, I could not find any explicit parameters or configuration options within This suggests that the PKCE extension to the OAuth 2.0 Authorization Code flow may not be directly supported by the current authentication framework for While there is a [1] https://google.github.io/adk-docs/tools-custom/authentication/ |
Beta Was this translation helpful? Give feedback.
-
|
Hi @adk-bot can I monkey patch this method to include the code verifier in request async def _exchange_client_credentials( Args: Returns: try: return ExchangeResult(auth_credential, True) |
Beta Was this translation helpful? Give feedback.
-
|
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: The ADK for Python supports OAuth2 for Hi @skullboy-1614, Thanks for your question. I've looked into the ADK documentation to see how OAuth2 with PKCE can be implemented for the Standard OAuth2 ConfigurationThe ADK supports OAuth2 by allowing you to configure an from google.adk.auth.auth_schemes import OpenIdConnectWithConfig
from google.adk.auth.auth_credential import AuthCredential, AuthCredentialTypes, OAuth2Auth
from google.adk.tools.openapi_tool.openapi_spec_parser.openapi_toolset import OpenAPIToolset
# 1. Define the Authentication Scheme
auth_scheme = OpenIdConnectWithConfig(
authorization_endpoint='OAUTH2_AUTH_ENDPOINT_URL',
token_endpoint='OAUTH2_TOKEN_ENDPOINT_URL',
scopes=['openid', 'YOUR_OAUTH_SCOPES']
)
# 2. Define the Authentication Credential
auth_credential = AuthCredential(
auth_type=AuthCredentialTypes.OPEN_ID_CONNECT,
oauth2=OAuth2Auth(
client_id="YOUR_CLIENT_ID",
client_secret="YOUR_CLIENT_SECRET",
)
)
# 3. Initialize the OpenAPIToolset with Auth configuration
my_toolset = OpenAPIToolset(
spec_str="...", # Your OpenAPI spec
spec_str_type='yaml',
auth_scheme=auth_scheme,
auth_credential=auth_credential,
)This configuration is well-documented for standard OAuth2 flows. [1] OAuth2 with PKCEYou specifically need to pass a The ADK framework is designed to handle the OAuth flow, including the exchange of the authorization code for an access token, automatically. [9] It seems that the current implementation may not have built-in support for the PKCE extension. This might be a feature that is not yet supported in the ADK. I would recommend raising this as a feature request on the I hope this information is helpful, even though it does not provide a direct solution to your problem. Best regards, [1] https://github.com/google/adk-python/blob/main/docs/tools-custom/authentication.html |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Everyone,
I am using OpenApiToolset using the Oauth auth schema but the API that I use support only Oauth with PKCE so I need to pass the code verifier to the token generation endpoint.
How can I do that since I cannot find a valid approach.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions