[GH-ISSUE #3197] Support async api key validation #26835

Closed
opened 2026-04-17 17:33:18 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @stephenlacy on GitHub (Jun 27, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/3197

Is this suited for github?

  • Yes, this is suited for github

I have a custom api key generator that uses a key from a async service. I would like to support fetching and verifying the key from the customAPIKeyValidator by converting it to an async function:

Describe the solution you'd like


plugins: [
  apiKey({
    customAPIKeyValidator: async ({ ctx, key }) => {
        const res = await keyService.verify(key)
        return res.valid
    }
  })
]

Describe alternatives you've considered

I have not seen any others solution in the docs that would solve this

Additional context

No response

Originally created by @stephenlacy on GitHub (Jun 27, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/3197 ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. I have a custom api key generator that uses a key from a async service. I would like to support fetching and verifying the key from the `customAPIKeyValidator` by converting it to an async function: ### Describe the solution you'd like ``` plugins: [ apiKey({ customAPIKeyValidator: async ({ ctx, key }) => { const res = await keyService.verify(key) return res.valid } }) ] ``` ### Describe alternatives you've considered I have not seen any others solution in the docs that would solve this ### Additional context _No response_
GiteaMirror added the lockedenhancement labels 2026-04-17 17:33:18 -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#26835