Add hooks for passkey creation, deletion, and updating #2684

Open
opened 2026-03-13 10:13:00 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @mhamid3d on GitHub (Jan 11, 2026).

Is this suited for github?

  • Yes, this is suited for github

Is your feature request related to a problem? Please describe.

I need to send emails upon passkey creation and deletion, there is no clean way to do this as the passkey plugin does not provide hooks.

Describe the solution you'd like

Add the following hooks to the plugin options:

  • beforeCreatePasskey
  • afterCreatePasskey
  • beforeDeletePasskey
  • afterDeletePasskey
  • beforeUpdatePasskey
  • afterUpdatePasskey

Describe alternatives you've considered

I have created some normal hooks but I am having to assign keys to the ctx to use for later.

Additional context

No response

Originally created by @mhamid3d on GitHub (Jan 11, 2026). ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. I need to send emails upon passkey creation and deletion, there is no clean way to do this as the passkey plugin does not provide hooks. ### Describe the solution you'd like Add the following hooks to the plugin options: - `beforeCreatePasskey` - `afterCreatePasskey` - `beforeDeletePasskey` - `afterDeletePasskey` - `beforeUpdatePasskey` - `afterUpdatePasskey` ### Describe alternatives you've considered I have created some normal hooks but I am having to assign keys to the ctx to use for later. ### Additional context _No response_
GiteaMirror added the enhancement label 2026-03-13 10:13:00 -05:00
Author
Owner

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

It seems you're requesting hooks for passkey creation, deletion, and updating to facilitate sending emails upon these actions. Currently, Better Auth does allow for hook implementations using plugin options, which could cater to your needs. Although there isn't a specified implementation for the hooks you proposed, you can add hooks for your plugin like so:

import { createAuthMiddleware } from "better-auth/plugins";
const myPlugin = () => {
  return {
    id: "my-plugin",
    hooks: {
      before: [
        // your before hooks go here
      ],
      after: [
        // your after hooks go here
      ],
    },
  } satisfies BetterAuthPlugin;
};

This allows you to customize the behavior before and after passkey-related actions. You mentioned the lack of a clean way to send emails; implementing these hooks could potentially solve that issue by adding your custom logic for email notifications.

Would these hooks work for your use case, or do you need assistance with implementing a specific part? Please feel free to ask more!

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 (Jan 11, 2026): It seems you're requesting hooks for passkey creation, deletion, and updating to facilitate sending emails upon these actions. Currently, Better Auth does allow for hook implementations using plugin options, which could cater to your needs. Although there isn't a specified implementation for the hooks you proposed, you can add hooks for your plugin like so: ```javascript import { createAuthMiddleware } from "better-auth/plugins"; const myPlugin = () => { return { id: "my-plugin", hooks: { before: [ // your before hooks go here ], after: [ // your after hooks go here ], }, } satisfies BetterAuthPlugin; }; ``` This allows you to customize the behavior before and after passkey-related actions. You mentioned the lack of a clean way to send emails; implementing these hooks could potentially solve that issue by adding your custom logic for email notifications. Would these hooks work for your use case, or do you need assistance with implementing a specific part? Please feel free to ask more! _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/skyvern_ultra_detailed_interactive.html) • [Discord](https://discord.gg/fG2XXEuQX3) • [GitHub](https://github.com/Skyvern-AI/Skyvern) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/skyvern_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/fG2XXEuQX3) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/Skyvern-AI/Skyvern)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2684