Allow storage option for OTP and email verification tokens, and allow 'secondary-storage' #3028

Closed
opened 2026-03-13 10:35:12 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @kvanbere on GitHub (Mar 11, 2026).

Is this suited for github?

  • Yes, this is suited for github

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

Observation:
Generation of email verification, magic link and two factor OTPs creates many verification rows in the table.
This creates database traffic that could be unnecessary.
It seems like these would be well-suited to secondary storage (KV storage) if available.

Describe the solution you'd like

Add a storage option to each plugin that generates one time passwords.
If all plugins have the storage option set to secondary-storage, then a table won't be created to store codes.

Describe alternatives you've considered

N/A

Additional context

No response

Originally created by @kvanbere on GitHub (Mar 11, 2026). ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. **Observation:** Generation of email verification, magic link and two factor OTPs creates many `verification` rows in the table. This creates database traffic that could be unnecessary. It seems like these would be well-suited to secondary storage (KV storage) if available. ### Describe the solution you'd like Add a `storage` option to each plugin that generates one time passwords. If all plugins have the `storage` option set to `secondary-storage`, then a table won't be created to store codes. ### Describe alternatives you've considered N/A ### Additional context _No response_
GiteaMirror added the enhancement label 2026-03-13 10:35:12 -05:00
Author
Owner

@GautamBytes commented on GitHub (Mar 12, 2026):

The behavior you were asking for is already supported, but it’s configured through Better Auth’s global verification storage settings rather than per-plugin storage options.

I opened a docs PR to make that clearer here

@GautamBytes commented on GitHub (Mar 12, 2026): The behavior you were asking for is already supported, but it’s configured through Better Auth’s global verification storage settings rather than per-plugin `storage` options. I opened a docs PR to make that clearer [here](https://github.com/better-auth/better-auth/pull/8569)
Author
Owner

@kvanbere commented on GitHub (Mar 13, 2026):

@GautamBytes even better, thank you!

@kvanbere commented on GitHub (Mar 13, 2026): @GautamBytes even better, thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#3028