[PR #5544] [CLOSED] feat(one-tap): support FedCM API #31673

Closed
opened 2026-04-17 22:33:51 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5544
Author: @okisdev
Created: 10/24/2025
Status: Closed

Base: canaryHead: feat(one-tap)/support-fedcm-api


📝 Commits (10+)

  • c02112c feat(one-tap): support fedcm api
  • 8787639 feat(one-tap): support fedcm api
  • 39f9950 feat(one-tap): support fedcm api
  • 878494e feat(one-tap): support fedcm api
  • 739281b Merge branch 'canary' into feat(one-tap)/support-fedcm-api
  • 11171dc feat(one-tap): support fedcm api
  • e734058 Merge branch 'canary' into feat(one-tap)/support-fedcm-api
  • db3c815 Merge branch 'canary' into feat(one-tap)/support-fedcm-api
  • 4008345 Merge branch 'canary' into feat(one-tap)/support-fedcm-api
  • 60a5259 feat(one-tap): support fedcm api

📊 Changes

4 files changed (+1575 additions, -138 deletions)

View changed files

📝 docs/content/docs/plugins/one-tap.mdx (+153 -1)
📝 docs/content/docs/reference/faq.mdx (+38 -0)
📝 packages/better-auth/src/plugins/one-tap/index.ts (+613 -137)
packages/better-auth/src/plugins/one-tap/one-tap.test.ts (+771 -0)

📄 Description

This PR adds support FedCM API as one of the advance way to implement Google One Tap.

FedCM is a more modern standard to provide auth service. Compared to the traditional Google One Tap, it does not rely on cookies and instead opts to use the browser's traditional native API, which is supported in Chrome 108+ and above.

This PR has implements FedCM API by doing the followings:

  • adding FedCM API support, users can freely choose between FedCM and traditional Google One Tap without compromising the user experience
  • adding related test cases
  • updating related One Tap docs

This PR closes https://github.com/better-auth/better-auth/issues/2243


Summary by cubic

Adds FedCM (Federated Credential Management) support to the One Tap plugin, offering a browser‑native, cookie‑less flow with automatic fallback to traditional Google One Tap. Introduces FedCM endpoints, proper CORS handling, docs, and extensive tests; addresses Chrome 108+ FedCM/CORS errors. Closes #2243.

  • New Features

    • oneTap({ fedcm: { enabled: true, privacyPolicyUrl, termsOfServiceUrl, branding } }) to opt in; traditional One Tap remains available and auto‑fallback is supported.
    • New endpoints: /.well-known/web-identity, /one-tap/fedcm/config, /one-tap/fedcm/accounts, /one-tap/fedcm/client-metadata, /one-tap/fedcm/assertion.
    • Callback accepts both Google ID tokens and self‑issued FedCM tokens (when enabled); account linking preserved using Google sub.
    • Spec‑compliant CORS headers and HTTPS requirement for FedCM.
    • Plugin docs and FAQ updated; comprehensive tests added.
  • Migration

    • Default behavior unchanged (FedCM is off).
    • To avoid current Chrome FedCM errors, set additionalOptions.use_fedcm_for_prompt = false on the client.
    • To enable FedCM: set fedcm.enabled: true on the server, provide privacy/terms URLs, and run over HTTPS.
    • Ensure the same clientId on client and server; plugin clientId overrides socialProviders.

Written for commit 55c0ec266b. 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/5544 **Author:** [@okisdev](https://github.com/okisdev) **Created:** 10/24/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `feat(one-tap)/support-fedcm-api` --- ### 📝 Commits (10+) - [`c02112c`](https://github.com/better-auth/better-auth/commit/c02112ce796cf04fc444b5bcfd95e5cfe14fcde3) feat(one-tap): support fedcm api - [`8787639`](https://github.com/better-auth/better-auth/commit/87876396c9107cc403688bc421782e74caa21402) feat(one-tap): support fedcm api - [`39f9950`](https://github.com/better-auth/better-auth/commit/39f9950c6337969d38981d296d5b3fe3d668384c) feat(one-tap): support fedcm api - [`878494e`](https://github.com/better-auth/better-auth/commit/878494efaf8cdc339ed6cb192ceff26475766e7d) feat(one-tap): support fedcm api - [`739281b`](https://github.com/better-auth/better-auth/commit/739281b4284ba8268c3d0705f9d8789b2d47d7f1) Merge branch 'canary' into feat(one-tap)/support-fedcm-api - [`11171dc`](https://github.com/better-auth/better-auth/commit/11171dcfcff2bed4b730d77140d5746c54a16e97) feat(one-tap): support fedcm api - [`e734058`](https://github.com/better-auth/better-auth/commit/e7340583a7444ca940ea0bd92b3a2386978063f7) Merge branch 'canary' into feat(one-tap)/support-fedcm-api - [`db3c815`](https://github.com/better-auth/better-auth/commit/db3c815a2d5b67aed4a8de9579f04064d157304a) Merge branch 'canary' into feat(one-tap)/support-fedcm-api - [`4008345`](https://github.com/better-auth/better-auth/commit/4008345a6d6965e1d28a14d3169acf4d9ee76e13) Merge branch 'canary' into feat(one-tap)/support-fedcm-api - [`60a5259`](https://github.com/better-auth/better-auth/commit/60a5259cc61f389c13b4f16c0b307cb3926424e1) feat(one-tap): support fedcm api ### 📊 Changes **4 files changed** (+1575 additions, -138 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/one-tap.mdx` (+153 -1) 📝 `docs/content/docs/reference/faq.mdx` (+38 -0) 📝 `packages/better-auth/src/plugins/one-tap/index.ts` (+613 -137) ➕ `packages/better-auth/src/plugins/one-tap/one-tap.test.ts` (+771 -0) </details> ### 📄 Description This PR adds support [FedCM API](https://developer.chrome.com/docs/identity/fedcm/overview) as one of the advance way to implement Google One Tap. FedCM is a more modern standard to provide auth service. Compared to the traditional Google One Tap, it does not rely on cookies and instead opts to use the browser's traditional native API, which is supported in Chrome 108+ and above. This PR has implements FedCM API by doing the followings: - adding FedCM API support, users can freely choose between FedCM and traditional Google One Tap without compromising the user experience - adding related test cases - updating related One Tap docs This PR closes https://github.com/better-auth/better-auth/issues/2243 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds FedCM (Federated Credential Management) support to the One Tap plugin, offering a browser‑native, cookie‑less flow with automatic fallback to traditional Google One Tap. Introduces FedCM endpoints, proper CORS handling, docs, and extensive tests; addresses Chrome 108+ FedCM/CORS errors. Closes #2243. - **New Features** - oneTap({ fedcm: { enabled: true, privacyPolicyUrl, termsOfServiceUrl, branding } }) to opt in; traditional One Tap remains available and auto‑fallback is supported. - New endpoints: /.well-known/web-identity, /one-tap/fedcm/config, /one-tap/fedcm/accounts, /one-tap/fedcm/client-metadata, /one-tap/fedcm/assertion. - Callback accepts both Google ID tokens and self‑issued FedCM tokens (when enabled); account linking preserved using Google sub. - Spec‑compliant CORS headers and HTTPS requirement for FedCM. - Plugin docs and FAQ updated; comprehensive tests added. - **Migration** - Default behavior unchanged (FedCM is off). - To avoid current Chrome FedCM errors, set additionalOptions.use_fedcm_for_prompt = false on the client. - To enable FedCM: set fedcm.enabled: true on the server, provide privacy/terms URLs, and run over HTTPS. - Ensure the same clientId on client and server; plugin clientId overrides socialProviders. <sup>Written for commit 55c0ec266b1a586f552a52486cb7eda43d5e2a04. 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-04-17 22:33:51 -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#31673