fix: proactively refresh Supabase JWT before API calls #84

Merged
TheFurya merged 7 commits from feature/fix-intermittent-401-errors into develop 2026-03-22 11:35:34 +01:00
Owner

Summary

  • Proactively refresh the Supabase JWT token before making API calls to prevent intermittent 401 errors caused by expired tokens
  • Update the API client to check token freshness and refresh when nearing expiry
  • Close out several false-positive crash/bug beans related to MFA and admin page ownership

Test plan

  • Verify API calls no longer produce intermittent 401 errors during long sessions
  • Confirm token refresh happens transparently without user interaction
  • Check that save/load operations work reliably without requiring re-login

🤖 Generated with Claude Code

## Summary - Proactively refresh the Supabase JWT token before making API calls to prevent intermittent 401 errors caused by expired tokens - Update the API client to check token freshness and refresh when nearing expiry - Close out several false-positive crash/bug beans related to MFA and admin page ownership ## Test plan - [ ] Verify API calls no longer produce intermittent 401 errors during long sessions - [ ] Confirm token refresh happens transparently without user interaction - [ ] Check that save/load operations work reliably without requiring re-login 🤖 Generated with [Claude Code](https://claude.com/claude-code)
TheFurya added 7 commits 2026-03-22 11:33:46 +01:00
Adds token expiry checking and automatic refresh to prevent intermittent
401 errors when the cached session token expires between interactions.

- Check token expiry (60s buffer) before each API call
- Add 401 interceptor that retries once with refreshed token
- Explicitly enable autoRefreshToken in Supabase client

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Work was already committed (3bd24fc) and merged to develop.
Crash recovery bean nuzlocke-tracker-ks9c also resolved.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Crash recovery for nuzlocke-tracker-f2hs: MFA feature was already
implemented and merged via PR #76. Verified code, tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The implementation was already complete and merged - just needed
the beans marked as done after agent crash.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Original bean (nuzlocke-tracker-2fp1) was already completed.
Commit a3f332f merged via PR #74.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
chore: scrap false-positive crash bean nuzlocke-tracker-9rm8
All checks were successful
CI / backend-tests (pull_request) Successful in 30s
CI / frontend-tests (pull_request) Successful in 28s
80d5d01993
MFA feature was already completed and merged via PR #76.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TheFurya merged commit d1ede63256 into develop 2026-03-22 11:35:34 +01:00
TheFurya deleted branch feature/fix-intermittent-401-errors 2026-03-22 11:35:35 +01:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: pokemon/nuzlocke-tracker#84