[PR #8018] fix(anonymous): update anonymous cleanup for passkey registration and callback linking #33290

Open
opened 2026-04-17 23:55:50 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8018
Author: @bytaesu
Created: 2/17/2026
Status: 🔄 Open

Base: mainHead: 2026-02-17/fix/anonymous-link-state


📝 Commits (5)

  • 1b412d1 fix(anonymous): handle passkey registration and account-link fallback
  • 1f425e8 fix: remove unnecessary matcher paths for cleanup hook
  • 58d363f test: migrate cleanup safeguards to getTestInstance integration tests
  • 59228f8 fix(anonymous): preserve anonymous flag on failed passkey registration
  • 761738d Merge branch 'canary' into 2026-02-17/fix/anonymous-link-state

📊 Changes

2 files changed (+219 additions, -97 deletions)

View changed files

📝 packages/better-auth/src/plugins/anonymous/anon.test.ts (+187 -85)
📝 packages/better-auth/src/plugins/anonymous/index.ts (+32 -12)

📄 Description


Summary by cubic

Fixes anonymous cleanup during account linking. Passkey registration and callback flows now set isAnonymous to false on success, even without a new session cookie; failures keep it true. Closes #7985.

  • Bug Fixes
    • Handle /passkey/verify-registration explicitly: on success set isAnonymous to false; on API errors preserve it.
    • Add fallback when no new session cookie exists: if the current anonymous user has linked accounts, set isAnonymous to false.
    • Limit middleware to existing anonymous sessions (disableRefresh) and include the registration route.
    • Convert cleanup safeguards to integration tests with getTestInstance, adding mock passkey verify and callback routes.

Written for commit 3aea3a3f3c321642299da1ee6e9567224e7b336f. Summary will update 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/8018 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 2/17/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `2026-02-17/fix/anonymous-link-state` --- ### 📝 Commits (5) - [`1b412d1`](https://github.com/better-auth/better-auth/commit/1b412d1c031dbc6b3549fe31d6fe791d15f6e52b) fix(anonymous): handle passkey registration and account-link fallback - [`1f425e8`](https://github.com/better-auth/better-auth/commit/1f425e8355f0be62202273f4c534268968ba933d) fix: remove unnecessary matcher paths for cleanup hook - [`58d363f`](https://github.com/better-auth/better-auth/commit/58d363f9a4a504f550cdc997934e6b1fee03038c) test: migrate cleanup safeguards to getTestInstance integration tests - [`59228f8`](https://github.com/better-auth/better-auth/commit/59228f807a9820e8ba3e52b7daed7908eaeda386) fix(anonymous): preserve anonymous flag on failed passkey registration - [`761738d`](https://github.com/better-auth/better-auth/commit/761738dbdc5326a4f256a3804508fc060297cacf) Merge branch 'canary' into 2026-02-17/fix/anonymous-link-state ### 📊 Changes **2 files changed** (+219 additions, -97 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/anonymous/anon.test.ts` (+187 -85) 📝 `packages/better-auth/src/plugins/anonymous/index.ts` (+32 -12) </details> ### 📄 Description - Closes #7985 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes anonymous cleanup during account linking. Passkey registration and callback flows now set isAnonymous to false on success, even without a new session cookie; failures keep it true. Closes #7985. - **Bug Fixes** - Handle /passkey/verify-registration explicitly: on success set isAnonymous to false; on API errors preserve it. - Add fallback when no new session cookie exists: if the current anonymous user has linked accounts, set isAnonymous to false. - Limit middleware to existing anonymous sessions (disableRefresh) and include the registration route. - Convert cleanup safeguards to integration tests with getTestInstance, adding mock passkey verify and callback routes. <sup>Written for commit 3aea3a3f3c321642299da1ee6e9567224e7b336f. Summary will update 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 23:55:50 -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#33290