Is Client Secret required when using OAuth with PKCE?

Hi,

We’re integrating our MCP server with Google Gemini Connected Apps using OAuth 2.0 Authorization Code flow with PKCE.

We noticed that the Google Connected Apps setup requires a Client Secret, while other MCP clients, such as Claude, allow it to be omitted when using PKCE.

According to your documentation:

  • PKCE is supported and used to secure the authorization code exchange.

  • The Client Secret is marked as optional for pre-registered clients.

We’d like to understand:

  1. Is there a reason Google requires a Client Secret even when PKCE is enabled?

  2. Does Google support a public OAuth client (without a Client Secret) with Authorization Code + PKCE?

  3. If the Client Secret field is mandatory in the UI, is there a supported way to use PKCE without an actual secret?

We’d prefer not to introduce a Client Secret if PKCE already provides the required protection.

Thanks!

Hello @Chava_Schatz,

No, a Client Secret is not required when using the user-delegated Authorization Code flow with PKCE. Public OAuth clients without a Client Secret are supported for Authorization Code with PKCE, while a Client Secret is only required for the Machine-to-machine (Client Credentials) flow.

When configuring pre-registered credentials in Step 4 of the Connected Apps setup guide, select User-delegated (Authorization Code) and Pre-registered, enter your Client ID, and leave Client secret (optional) blank (or use Client ID metadata or Dynamic Client Registration if your server supports it). Please try saving your configuration again with the Client Secret field left blank.

Note: As a friendly heads-up, this forum focuses on Google AI Studio, the Gemini API, and related Google AI developer tools. If you still run into trouble after retrying, please reach out through Google Play Console support or the Help menu in the Gemini app.