Passkey name is also saved in authenticator #2851

Closed
opened 2026-03-13 10:23:28 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @JE4GLE on GitHub (Feb 9, 2026).

To Reproduce

Create a passkey using the following code:

const result = await authClient.passkey.addPasskey({
	authenticatorAttachment: 'platform',
	name: deviceName
});

Current vs. Expected behavior

Current behavior

The name of the passkey (name: deviceName) is saved in the database as device name and as the name of the passkey in the users password manager:

Image

Expected behavior

The passkey isn't named after the device name in the password manager. I'd prefer it defaulting to the username or even better make it customizable.

What version of Better Auth are you using?

1.4.18

System info

{
  "system": {
    "platform": "darwin",
    "arch": "arm64",
    "version": "Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:41 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T6031",
    "release": "25.2.0",
    "cpuCount": 16,
    "cpuModel": "Apple M3 Max",
    "totalMemory": "64.00 GB",
    "freeMemory": "0.49 GB"
  },
  "node": {
    "version": "v25.2.1",
    "env": "development"
  },
  "packageManager": {
    "name": "npm",
    "version": "11.6.2"
  },
  "frameworks": [
    {
      "name": "svelte",
      "version": "^5.50.0"
    },
    {
      "name": "@sveltejs/kit",
      "version": "^2.50.2"
    }
  ],
  "databases": [
    {
      "name": "postgres",
      "version": "^3.4.8"
    },
    {
      "name": "drizzle",
      "version": "^0.45.1"
    }
  ],
  "betterAuth": {
    "version": "Unknown",
    "config": null,
    "error": "Cannot find module '$app/environment'\nRequire stack:\n- /Users/user/development/project/src/lib/server/auth.ts"
  }
}

Which area(s) are affected? (Select all that apply)

Package

Auth config (if applicable)

passkey({
  rpID: dev ? 'localhost' : PUBLIC_DOMAIN,
  rpName: __APP_NAME__,
  origin: PUBLIC_DOMAIN.replace(/\/$/, ''),
  authenticatorSelection: {
    authenticatorAttachment: 'platform',
    residentKey: 'discouraged',
    userVerification: 'discouraged'
  }
})

Additional context

No response

Originally created by @JE4GLE on GitHub (Feb 9, 2026). ### To Reproduce Create a passkey using the following code: ```typescript const result = await authClient.passkey.addPasskey({ authenticatorAttachment: 'platform', name: deviceName }); ``` ### Current vs. Expected behavior #### Current behavior The name of the passkey (`name: deviceName`) is saved in the database as device name **and as the name of the passkey in the users password manager:** <img width="265" height="69" alt="Image" src="https://github.com/user-attachments/assets/70102f3e-b946-493d-983e-39c4b846aa10" /> #### Expected behavior The passkey isn't named after the device name in the password manager. I'd prefer it defaulting to the username or even better make it customizable. ### What version of Better Auth are you using? 1.4.18 ### System info ```bash { "system": { "platform": "darwin", "arch": "arm64", "version": "Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:41 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T6031", "release": "25.2.0", "cpuCount": 16, "cpuModel": "Apple M3 Max", "totalMemory": "64.00 GB", "freeMemory": "0.49 GB" }, "node": { "version": "v25.2.1", "env": "development" }, "packageManager": { "name": "npm", "version": "11.6.2" }, "frameworks": [ { "name": "svelte", "version": "^5.50.0" }, { "name": "@sveltejs/kit", "version": "^2.50.2" } ], "databases": [ { "name": "postgres", "version": "^3.4.8" }, { "name": "drizzle", "version": "^0.45.1" } ], "betterAuth": { "version": "Unknown", "config": null, "error": "Cannot find module '$app/environment'\nRequire stack:\n- /Users/user/development/project/src/lib/server/auth.ts" } } ``` ### Which area(s) are affected? (Select all that apply) Package ### Auth config (if applicable) ```typescript passkey({ rpID: dev ? 'localhost' : PUBLIC_DOMAIN, rpName: __APP_NAME__, origin: PUBLIC_DOMAIN.replace(/\/$/, ''), authenticatorSelection: { authenticatorAttachment: 'platform', residentKey: 'discouraged', userVerification: 'discouraged' } }) ``` ### Additional context _No response_
GiteaMirror added the enhancement label 2026-03-13 10:23:28 -05:00
Author
Owner

@better-auth-agent[bot] commented on GitHub (Feb 9, 2026):

It seems that you are inquiring about an issue related to the passkey implementation in Better Auth, where the passkey name is saved both in the database as device name and in the user's password manager.

Given the details you've provided, here are the next steps you might consider:

  1. Understanding the Implementation: The function you are using to add a passkey allows you to set a name (name: deviceName). According to the documentation, if a name is not provided, it defaults to the user’s email address or user ID. This implies that the current behavior where the name is saved in multiple places might be a result of the intended functionality.

  2. Potential Fix: If you want to change or customize how the passkey name is saved, consider using the function call to update the passkey name after it has been created. You can use authClient.passkey.updatePasskey to modify the name later if needed.

  3. Check for Updates: Ensure that you are using the latest version of Better Auth, as newer releases may include updates or changes to the functionality that could address your concerns.

  4. Consult the Community: If you believe this is an unintended behavior rather than an intended feature, you might want to open an issue in the GitHub repository for Better Auth or tag the developers for further clarification.

If you have further questions or if there are additional details regarding your setup, feel free to share! Also, are you experiencing any specific issues when trying to sign in or register a passkey?

If you need more help, tag @better-auth-agent in a comment so I can respond.

DiagramDiscordGitHub

Diagram Join Star

@better-auth-agent[bot] commented on GitHub (Feb 9, 2026): It seems that you are inquiring about an issue related to the passkey implementation in Better Auth, where the passkey name is saved both in the database as device name and in the user's password manager. Given the details you've provided, here are the next steps you might consider: 1. **Understanding the Implementation**: The function you are using to add a passkey allows you to set a name (`name: deviceName`). According to the documentation, if a name is not provided, it defaults to the user’s email address or user ID. This implies that the current behavior where the name is saved in multiple places might be a result of the intended functionality. 2. **Potential Fix**: If you want to change or customize how the passkey name is saved, consider using the function call to update the passkey name after it has been created. You can use `authClient.passkey.updatePasskey` to modify the name later if needed. 3. **Check for Updates**: Ensure that you are using the latest version of Better Auth, as newer releases may include updates or changes to the functionality that could address your concerns. 4. **Consult the Community**: If you believe this is an unintended behavior rather than an intended feature, you might want to open an issue in the GitHub repository for Better Auth or tag the developers for further clarification. If you have further questions or if there are additional details regarding your setup, feel free to share! Also, are you experiencing any specific issues when trying to sign in or register a passkey? _If you need more help, tag @better-auth-agent in a comment so I can respond._ <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) • [Discord](https://discord.gg/better-auth) • [GitHub](https://github.com/better-auth/better-auth) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/better-auth) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/better-auth/better-auth)
Author
Owner

@JE4GLE commented on GitHub (Feb 9, 2026):

@better-auth-agent No technical issues, just users complaining that the passkey is not paired with their username & password, due to the different device name.

@JE4GLE commented on GitHub (Feb 9, 2026): @better-auth-agent No technical issues, just users complaining that the passkey is not paired with their username & password, due to the different device name.
Author
Owner

@better-auth-agent[bot] commented on GitHub (Feb 9, 2026):

It appears you have an issue where the passkey being stored in the password manager reflects the device name instead of the username or a customizable option. Currently, the passkey name is set using the name property when calling the addPasskey function. If not provided, it defaults to the user's email address or user ID, which may lead to confusion among users using the same device [1].

To resolve your concern, you might want to look into customizing the passkey name manually when adding the passkey using the addPasskey method. Here is an example of how you can specify a custom name:

const result = await authClient.passkey.addPasskey({
  authenticatorAttachment: 'platform',
  name: 'my-custom-passkey-name'
});

If this behavior is not what you expect for the default naming, it could be beneficial to raise a suggestion for improving the customization capabilities in the Better Auth GitHub issues.

Would you like help with anything else related to configuring your passkeys or other features?

DiagramDiscordGitHub

Diagram Join Star

@better-auth-agent[bot] commented on GitHub (Feb 9, 2026): It appears you have an issue where the passkey being stored in the password manager reflects the device name instead of the username or a customizable option. Currently, the passkey name is set using the `name` property when calling the `addPasskey` function. If not provided, it defaults to the user's email address or user ID, which may lead to confusion among users using the same device [[1]](https://www.better-auth.com/docs/plugins/passkey). To resolve your concern, you might want to look into customizing the passkey name manually when adding the passkey using the `addPasskey` method. Here is an example of how you can specify a custom name: ```typescript const result = await authClient.passkey.addPasskey({ authenticatorAttachment: 'platform', name: 'my-custom-passkey-name' }); ``` If this behavior is not what you expect for the default naming, it could be beneficial to raise a suggestion for improving the customization capabilities in the Better Auth GitHub issues. Would you like help with anything else related to configuring your passkeys or other features? <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) • [Discord](https://discord.gg/better-auth) • [GitHub](https://github.com/better-auth/better-auth) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/better-auth) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/better-auth/better-auth)
Author
Owner

@ping-maxwell commented on GitHub (Feb 11, 2026):

Hello, we're moving all feature requests or enhancement issues over to Github Discussions.

I've went ahead and created the discussion here:
https://github.com/better-auth/better-auth/discussions/7912

@ping-maxwell commented on GitHub (Feb 11, 2026): Hello, we're moving all feature requests or enhancement issues over to Github Discussions. I've went ahead and created the discussion here: https://github.com/better-auth/better-auth/discussions/7912
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2851