Support async api key validation #1429

Closed
opened 2026-03-13 08:39:48 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @stephenlacy on GitHub (Jun 27, 2025).

Is this suited for github?

  • 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

Originally created by @stephenlacy on GitHub (Jun 27, 2025). ### 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 enhancement label 2026-03-13 08:39:48 -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#1429