[PR #6380] [MERGED] feat(one-tap): add fedcm support #6626

Closed
opened 2026-03-13 13:06:00 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6380
Author: @jslno
Created: 11/28/2025
Status: Merged
Merged: 11/30/2025
Merged by: @Bekacru

Base: canaryHead: 11-28-2025/one-tap-fedcm


📝 Commits (10+)

📊 Changes

2 files changed (+187 additions, -89 deletions)

View changed files

📝 docs/content/docs/plugins/one-tap.mdx (+1 -1)
📝 packages/better-auth/src/plugins/one-tap/client.ts (+186 -88)

📄 Description

Related: https://discord.com/channels/1288403910284935179/1440760515021377666

Adds support for fedcm as it'll become mandatory in future.

[GSI_LOGGER]: Your client application uses one of the Google One Tap prompt UI status methods that may stop functioning when FedCM becomes mandatory. Refer to the migration guide to update your code accordingly and opt-in to FedCM to test your changes. Learn more: https://developers.google.com/identity/gsi/web/guides/fedcm-migration?s=dc#display_moment and https://developers.google.com/identity/gsi/web/guides/fedcm-migration?s=dc#skipped_moment

For testing make sure you have chrome://settings/content/federatedIdentityApi enabled


Summary by cubic

Adds FedCM support to the One Tap client with automatic fallback to Google One Tap. Improves sign-out and request handling to make prompts more reliable ahead of the FedCM mandate.

  • New Features

    • FedCM is enabled by default when supported; opt out via promptOptions.fedCM: false.
    • Falls back to Google One Tap when FedCM isn’t available; loads the GSI script only when needed.
    • Adds a sign-out hook that calls navigator.credentials.preventSilentAccess.
    • Prevents overlapping prompts using an AbortController.
    • Adds nonce support and updates onPromptNotification to handle dismiss/skip and no-token cases.
  • Migration

    • To disable FedCM, set promptOptions.fedCM: false.
    • Handle dismiss/skip with onPromptNotification, which may receive undefined when no token is returned.
    • Ensure sign-out uses the /sign-out route so silent access is cleared.

Written for commit d6b3853693. 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/6380 **Author:** [@jslno](https://github.com/jslno) **Created:** 11/28/2025 **Status:** ✅ Merged **Merged:** 11/30/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `11-28-2025/one-tap-fedcm` --- ### 📝 Commits (10+) - [`05548c4`](https://github.com/better-auth/better-auth/commit/05548c4519dc2bbe7d5992697eeb1567cc5e91d8) refactor(one-tap): add fedcm support - [`59253db`](https://github.com/better-auth/better-auth/commit/59253db6128fbfc1054b3fd2f8e0d72436e61ca1) chore: fix linting - [`6c6d48f`](https://github.com/better-auth/better-auth/commit/6c6d48fdb69c3915f65c2b16f3121a0afc20ce66) chore: cleanup - [`cf6b259`](https://github.com/better-auth/better-auth/commit/cf6b259f0e5341ecdd9e23a470efa46723dc1479) chore: properly apply nonce - [`9b3d831`](https://github.com/better-auth/better-auth/commit/9b3d8310f0d6a4e07e31ca1e4e3c1595bba0cf4c) chore: remove experimental prefix - [`c8b3296`](https://github.com/better-auth/better-auth/commit/c8b32968361c8b156013f19a59cc9d538046b225) chore: make opt-out - [`6f0acea`](https://github.com/better-auth/better-auth/commit/6f0acea3640d1d4f89872247791369b752d4a5e2) Merge branch 'canary' into 11-28-2025/one-tap-fedcm - [`eb9f595`](https://github.com/better-auth/better-auth/commit/eb9f5950d86e1d97effda14e6e1d43dd1a493de1) chore: fix linting - [`e195cde`](https://github.com/better-auth/better-auth/commit/e195cdee7ff204b90b244b6a356d019d58ccefe4) chore: update jsdoc - [`d6b3853`](https://github.com/better-auth/better-auth/commit/d6b3853693760a933ace47b7ea85978db0bf8f38) chore: update docs ### 📊 Changes **2 files changed** (+187 additions, -89 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/one-tap.mdx` (+1 -1) 📝 `packages/better-auth/src/plugins/one-tap/client.ts` (+186 -88) </details> ### 📄 Description Related: https://discord.com/channels/1288403910284935179/1440760515021377666 Adds support for fedcm as it'll become mandatory in future. `[GSI_LOGGER]: Your client application uses one of the Google One Tap prompt UI status methods that may stop functioning when FedCM becomes mandatory. Refer to the migration guide to update your code accordingly and opt-in to FedCM to test your changes. Learn more: https://developers.google.com/identity/gsi/web/guides/fedcm-migration?s=dc#display_moment and https://developers.google.com/identity/gsi/web/guides/fedcm-migration?s=dc#skipped_moment` For testing make sure you have `chrome://settings/content/federatedIdentityApi` enabled <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds FedCM support to the One Tap client with automatic fallback to Google One Tap. Improves sign-out and request handling to make prompts more reliable ahead of the FedCM mandate. - **New Features** - FedCM is enabled by default when supported; opt out via promptOptions.fedCM: false. - Falls back to Google One Tap when FedCM isn’t available; loads the GSI script only when needed. - Adds a sign-out hook that calls navigator.credentials.preventSilentAccess. - Prevents overlapping prompts using an AbortController. - Adds nonce support and updates onPromptNotification to handle dismiss/skip and no-token cases. - **Migration** - To disable FedCM, set promptOptions.fedCM: false. - Handle dismiss/skip with onPromptNotification, which may receive undefined when no token is returned. - Ensure sign-out uses the /sign-out route so silent access is cleared. <sup>Written for commit d6b3853693760a933ace47b7ea85978db0bf8f38. 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 13:06:00 -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#6626