[PR #865] [MERGED] fix(passkey): Add credentialID field in favor of generated ids #20418

Closed
opened 2026-04-15 19:41:26 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/865
Author: @masterjanic
Created: 12/12/2024
Status: Merged
Merged: 12/21/2024
Merged by: @Bekacru

Base: mainHead: passkey-fix


📝 Commits (5)

  • 187a3ae fix: add field credentialID, change fields
  • 97a761c Merge branch 'main' into passkey-fix
  • 5d6d3b7 fix: tests
  • 8dd669b fix: update test
  • 197f049 fix: improve type-safety of test data

📊 Changes

3 files changed (+71 additions, -70 deletions)

View changed files

📝 docs/content/docs/plugins/passkey.mdx (+56 -56)
📝 packages/better-auth/src/plugins/passkey/index.ts (+7 -7)
📝 packages/better-auth/src/plugins/passkey/passkey.test.ts (+8 -7)

📄 Description

As per discussion in Discord, we should add an unique credentialID field to prevent wrong id storing when registering a passkey.

When migrating the database schema existing users should rename the existing id field to credentialID. After that the currently used webauthnUserID field can be renamed to id (primary key).

With these changes the generated id will be stored in the new primary key field.


🔄 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/865 **Author:** [@masterjanic](https://github.com/masterjanic) **Created:** 12/12/2024 **Status:** ✅ Merged **Merged:** 12/21/2024 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `passkey-fix` --- ### 📝 Commits (5) - [`187a3ae`](https://github.com/better-auth/better-auth/commit/187a3aebe1da4ece526c0d1b765ae84e570a4f43) fix: add field credentialID, change fields - [`97a761c`](https://github.com/better-auth/better-auth/commit/97a761c48636b77727884c243cc447a4a275c20c) Merge branch 'main' into passkey-fix - [`5d6d3b7`](https://github.com/better-auth/better-auth/commit/5d6d3b72e839e36c0b779103c1e092560829a240) fix: tests - [`8dd669b`](https://github.com/better-auth/better-auth/commit/8dd669b982aa3427825a47cf22a0dfab5c4c7001) fix: update test - [`197f049`](https://github.com/better-auth/better-auth/commit/197f0496e5cd18fa947c5b30a37ee193d08f887f) fix: improve type-safety of test data ### 📊 Changes **3 files changed** (+71 additions, -70 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/passkey.mdx` (+56 -56) 📝 `packages/better-auth/src/plugins/passkey/index.ts` (+7 -7) 📝 `packages/better-auth/src/plugins/passkey/passkey.test.ts` (+8 -7) </details> ### 📄 Description [As per discussion in Discord](https://discord.com/channels/1288403910284935179/1316497690359763035), we should add an unique `credentialID` field to prevent wrong id storing when registering a passkey. When migrating the database schema existing users should rename the existing `id` field to `credentialID`. After that the currently used `webauthnUserID` field can be renamed to `id` (primary key). With these changes the generated id will be stored in the new primary key field. --- <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-15 19:41:26 -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#20418