Make it possible to get an API key after creation #1168

Closed
opened 2026-03-13 08:26:17 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @voxain on GitHub (May 6, 2025).

Is this suited for github?

  • Yes, this is suited for github

As I know that API keys are hashed in the database and security is a big aspect of BA, this might be tricky to implement. But we've come across an environment in which API keys are not as severe to lose in case of a breach, due to them serving only one function.

Describe the solution you'd like

A solution that would work with the current system would be to be able to set a flag on initialization to skip the encryption/hashing process of the keys, which will also enable access to a function to get an API key after it has been created.

Describe alternatives you've considered

The only alternative I've been able to think of in our situation would be to write the entire system ourselves or just roll with the feature not being available. But it would be really useful if it was possible.

Additional context

No response

Originally created by @voxain on GitHub (May 6, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. As I know that API keys are hashed in the database and security is a big aspect of BA, this might be tricky to implement. But we've come across an environment in which API keys are not as severe to lose in case of a breach, due to them serving only one function. ### Describe the solution you'd like A solution that would work with the current system would be to be able to set a flag on initialization to skip the encryption/hashing process of the keys, which will also enable access to a function to get an API key after it has been created. ### Describe alternatives you've considered The only alternative I've been able to think of in our situation would be to write the entire system ourselves or just roll with the feature not being available. But it would be really useful if it was possible. ### Additional context _No response_
Author
Owner

@ping-maxwell commented on GitHub (Jul 8, 2025):

Hey @voxain , you can do this:

apiKey({ disableKeyHashing: true })
@ping-maxwell commented on GitHub (Jul 8, 2025): Hey @voxain , you can do this: ```ts apiKey({ disableKeyHashing: true }) ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1168