[PR #3587] [MERGED] feat(passkey): allow custom passkey name during registration #21800

Closed
opened 2026-04-15 20:36:45 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3587
Author: @Fyoxy
Created: 7/24/2025
Status: Merged
Merged: 8/1/2025
Merged by: @Bekacru

Base: mainHead: feat/passkey-name


📝 Commits (8)

  • 3ec2ab5 feat(passkey): allow custom passkey name during registration
  • 07a000c lint
  • 8d5789d Merge branch 'better-auth:main' into feat/passkey-name
  • 74801a9 docs: specify name prop in passkey docs
  • ede28b5 chore: add changeset
  • e98f1e7 chore: changeset
  • 44ac4d6 chore: update changeset
  • 8d4db00 remove changest

📊 Changes

4 files changed (+19 additions, -1 deletions)

View changed files

.changeset/curly-kids-film.md (+5 -0)
📝 docs/content/docs/plugins/passkey.mdx (+4 -0)
📝 packages/better-auth/src/plugins/passkey/client.ts (+3 -0)
📝 packages/better-auth/src/plugins/passkey/index.ts (+7 -1)

📄 Description

Summary

Fixes an issue in the Passkey plugin where the name parameter provided during registration was previously ignored. The implementation now correctly passes and applies the name as the userName when adding a new passkey.

Changes

  • Added optional name field support to the passkey schema and OpenAPI metadata.
  • Updated getPasskeyActions to include name in the options passed to the WebAuthn API.
  • Modified passkey registration to prioritize name as userName if provided, falling back to email or user ID.

Testing

Call addPasskey with a custom name:

const { data, error } = await authClient.passkey.addPasskey({
  name: "your-passkey-name",
  authenticatorAttachment: "cross-platform",
});

Notes

No breaking changes.
Please let me know if there's anything else I should check.


Summary by cubic

Added support for setting a custom passkey name during registration. The provided name is now used as the userName for new passkeys if specified.

  • New Features
    • Accepts an optional name field in the passkey registration API and schema.
    • Uses the custom name as userName, falling back to email or user ID if not provided.

🔄 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/3587 **Author:** [@Fyoxy](https://github.com/Fyoxy) **Created:** 7/24/2025 **Status:** ✅ Merged **Merged:** 8/1/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `feat/passkey-name` --- ### 📝 Commits (8) - [`3ec2ab5`](https://github.com/better-auth/better-auth/commit/3ec2ab5b39fa1f08e0527b39565c4c899a4aa92f) feat(passkey): allow custom passkey name during registration - [`07a000c`](https://github.com/better-auth/better-auth/commit/07a000c2770ea43f724e3c4d48cff06f73dc3fc8) lint - [`8d5789d`](https://github.com/better-auth/better-auth/commit/8d5789d2b9971f8b73d5c6d7a9ea42b1b69fb95c) Merge branch 'better-auth:main' into feat/passkey-name - [`74801a9`](https://github.com/better-auth/better-auth/commit/74801a91367cd543ca3fb1bbafadab7dcf146805) docs: specify name prop in passkey docs - [`ede28b5`](https://github.com/better-auth/better-auth/commit/ede28b59612ec7bcab60e277262c723002c2490c) chore: add changeset - [`e98f1e7`](https://github.com/better-auth/better-auth/commit/e98f1e7df2d6adddde30d17d21611143e423dbf1) chore: changeset - [`44ac4d6`](https://github.com/better-auth/better-auth/commit/44ac4d6d1b2844d6c20b28d75fc4a2ee57c93d9c) chore: update changeset - [`8d4db00`](https://github.com/better-auth/better-auth/commit/8d4db00022ca3d7cc4666a361d117e7e3f53a5a9) remove changest ### 📊 Changes **4 files changed** (+19 additions, -1 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/curly-kids-film.md` (+5 -0) 📝 `docs/content/docs/plugins/passkey.mdx` (+4 -0) 📝 `packages/better-auth/src/plugins/passkey/client.ts` (+3 -0) 📝 `packages/better-auth/src/plugins/passkey/index.ts` (+7 -1) </details> ### 📄 Description ## Summary Fixes an issue in the Passkey plugin where the `name` parameter provided during registration was previously ignored. The implementation now correctly passes and applies the `name` as the `userName` when adding a new passkey. ## Changes - Added optional `name` field support to the passkey schema and OpenAPI metadata. - Updated `getPasskeyActions` to include `name` in the options passed to the WebAuthn API. - Modified passkey registration to prioritize `name` as `userName` if provided, falling back to email or user ID. ## Testing Call `addPasskey` with a custom name: ```ts const { data, error } = await authClient.passkey.addPasskey({ name: "your-passkey-name", authenticatorAttachment: "cross-platform", }); ``` ## Notes No breaking changes. Please let me know if there's anything else I should check. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Added support for setting a custom passkey name during registration. The provided name is now used as the userName for new passkeys if specified. - **New Features** - Accepts an optional name field in the passkey registration API and schema. - Uses the custom name as userName, falling back to email or user ID if not provided. <!-- 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-15 20:36:45 -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#21800