[PR #5882] [CLOSED] feat: add support for multiple Google client IDs for cross-platform authentication #6293

Closed
opened 2026-03-13 12:53:43 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5882
Author: @MemerGamer
Created: 11/10/2025
Status: Closed

Base: canaryHead: feat/google-multiple-client-ids


📝 Commits (10+)

  • 5c92dc7 feat(google): support multiple client IDs for OAuth2 provider
  • f965870 Merge branch 'canary' into feat/google-multiple-client-ids
  • c940a81 docs: enhance Google authentication documentation for multiple client IDs
  • 3ebe60e refactor(auth): simplify clientId type in ProviderOptions and GoogleOptions
  • 603b1fb fix(auth): handle empty clientId array in Google provider
  • 9b563e3 fix(auth): added non-null assertions for session signal and account table fields
  • 862f962 feat: updated docs/content/docs/installation.mdx
  • b6de547 fix: updated docs/content/docs/installation.mdx
  • e897871 fix(tests): reordered imports and improved formatting in Google provider tests
  • 2b0e0e8 fix(tests): enhanced Google provider tests for multiple client IDs

📊 Changes

7 files changed (+720 additions, -23 deletions)

View changed files

📝 docs/content/docs/authentication/google.mdx (+25 -0)
📝 docs/content/docs/concepts/oauth.mdx (+21 -0)
📝 docs/content/docs/installation.mdx (+253 -0)
packages/better-auth/src/social-providers/test/google-multiple-client-ids.test.ts (+340 -0)
📝 packages/core/src/oauth2/oauth-provider.ts (+2 -4)
📝 packages/core/src/social-providers/google.ts (+78 -18)
📝 packages/core/src/social-providers/tiktok.ts (+1 -1)

📄 Description

This is an updated fork of: https://github.com/RikhiSingh/better-auth/tree/feat/google-multiple-client-ids branch

Related issue: https://github.com/better-auth/better-auth/issues/4498
And previously closed PR: https://github.com/better-auth/better-auth/pull/4583

Until this gets merged: https://github.com/better-auth/better-auth/issues/4498#issuecomment-3659493448


Summary by cubic

Adds multi-client ID support to the Google provider so cross-platform apps (iOS, Android, Web) can authenticate reliably. Uses the first ID for OAuth flows and validates ID tokens against all configured IDs.

  • New Features

    • Google provider accepts clientId as a string or an array.
    • First client ID is used for auth URL, code exchange, and token refresh; ID token verification checks all IDs.
    • Docs updated with setup examples; tests added for multi-ID verification and flows.
  • Refactors

    • ProviderOptions clientId is now a required string; GoogleOptions overrides to allow string | string[].
    • Added error for empty clientId arrays and accepted issuer "accounts.google.com" (without https).
    • TikTok options now omit clientId; minor test/type cleanups.

Written for commit b9cff49095. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/5882 **Author:** [@MemerGamer](https://github.com/MemerGamer) **Created:** 11/10/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `feat/google-multiple-client-ids` --- ### 📝 Commits (10+) - [`5c92dc7`](https://github.com/better-auth/better-auth/commit/5c92dc7c612d9f2c78f87fac214dcd59173f4349) feat(google): support multiple client IDs for OAuth2 provider - [`f965870`](https://github.com/better-auth/better-auth/commit/f965870c6cab1cd3ef070555273651adf63d70cf) Merge branch 'canary' into feat/google-multiple-client-ids - [`c940a81`](https://github.com/better-auth/better-auth/commit/c940a819872c58321a3f5ad7acb25e6206947ca7) docs: enhance Google authentication documentation for multiple client IDs - [`3ebe60e`](https://github.com/better-auth/better-auth/commit/3ebe60ebe9dd9f509dca197678d56ccdb6bdb6aa) refactor(auth): simplify clientId type in ProviderOptions and GoogleOptions - [`603b1fb`](https://github.com/better-auth/better-auth/commit/603b1fb68f17b7d79b0f3553113e02dd068958ca) fix(auth): handle empty clientId array in Google provider - [`9b563e3`](https://github.com/better-auth/better-auth/commit/9b563e31bb47f864fd217dbe636fb06a51756963) fix(auth): added non-null assertions for session signal and account table fields - [`862f962`](https://github.com/better-auth/better-auth/commit/862f962c888ff848b262e59426c52afa79ec7492) feat: updated docs/content/docs/installation.mdx - [`b6de547`](https://github.com/better-auth/better-auth/commit/b6de547930e3f959502c3707f16cfb92b783d17d) fix: updated docs/content/docs/installation.mdx - [`e897871`](https://github.com/better-auth/better-auth/commit/e89787197a37e37a966c381b7ac0ccd1a0285a6b) fix(tests): reordered imports and improved formatting in Google provider tests - [`2b0e0e8`](https://github.com/better-auth/better-auth/commit/2b0e0e83e2419dc980bb49187639b6afb78c507a) fix(tests): enhanced Google provider tests for multiple client IDs ### 📊 Changes **7 files changed** (+720 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/authentication/google.mdx` (+25 -0) 📝 `docs/content/docs/concepts/oauth.mdx` (+21 -0) 📝 `docs/content/docs/installation.mdx` (+253 -0) ➕ `packages/better-auth/src/social-providers/test/google-multiple-client-ids.test.ts` (+340 -0) 📝 `packages/core/src/oauth2/oauth-provider.ts` (+2 -4) 📝 `packages/core/src/social-providers/google.ts` (+78 -18) 📝 `packages/core/src/social-providers/tiktok.ts` (+1 -1) </details> ### 📄 Description This is an updated fork of: https://github.com/RikhiSingh/better-auth/tree/feat/google-multiple-client-ids branch Related issue: https://github.com/better-auth/better-auth/issues/4498 And previously closed PR: https://github.com/better-auth/better-auth/pull/4583 Until this gets merged: https://github.com/better-auth/better-auth/issues/4498#issuecomment-3659493448 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds multi-client ID support to the Google provider so cross-platform apps (iOS, Android, Web) can authenticate reliably. Uses the first ID for OAuth flows and validates ID tokens against all configured IDs. - **New Features** - Google provider accepts clientId as a string or an array. - First client ID is used for auth URL, code exchange, and token refresh; ID token verification checks all IDs. - Docs updated with setup examples; tests added for multi-ID verification and flows. - **Refactors** - ProviderOptions clientId is now a required string; GoogleOptions overrides to allow string | string[]. - Added error for empty clientId arrays and accepted issuer "accounts.google.com" (without https). - TikTok options now omit clientId; minor test/type cleanups. <sup>Written for commit b9cff490957c91f05e25fc88faf2aec32d048409. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:53:43 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#6293