Commit fee94a6
authored
fix(auth): pin OAuth state + sessions to Postgres regardless of Redis (#85)
When secondaryStorage is configured Better Auth routes verification
(OAuth state, magic-link tokens, email-verify tokens) and sessions
through it by default. When Redis hiccups — even briefly — those
disappear and OAuth callbacks fail with 'State mismatch: verification
not found'.
Pin both to the DB:
- verification.storeInDatabase: true
- session.storeSessionInDatabase: true
Redis remains the secondaryStorage backend for rate-limit counters
(rateLimit.storage = 'secondary-storage'), which is the original
intent of #34. Rate-limit is best-effort cache, OAuth state is not.1 parent 2b89217 commit fee94a6
1 file changed
Lines changed: 9 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
36 | 39 | | |
| 40 | + | |
| 41 | + | |
37 | 42 | | |
38 | 43 | | |
39 | 44 | | |
| |||
0 commit comments