Difficulty: Intermediate
Type: bug
Background
The README documents that "401 from backend shows inline re-auth banner without page redirect" as step 8 of the SIWE sign-in flow, implying admins can re-authenticate in place after a session expires.
Problem
After an admin re-authenticates via the inline banner, the mutation that originally triggered the 401 (e.g., a role assignment or policy update) is likely lost, forcing the admin to manually redo the action instead of it completing automatically once a valid session is restored.
Expected outcome
When a mutation fails with 401 (via AuthError from lib/api/live.ts), the UI shows the re-auth banner, and upon successful re-authentication, the original mutation is automatically retried with the new token — with a clear success/failure toast either way.
Suggested implementation
- Extend the
AuthError handling path in lib/api/live.ts (or the calling hook) to capture the failed request's parameters before surfacing the re-auth banner.
- After
useSiweAuth() completes a successful re-auth, replay the captured request using the new token.
- Ensure only one retry attempt occurs (avoid infinite loops if the retried request also 401s).
- Add a toast/notification confirming whether the retried mutation succeeded.
Acceptance criteria
Likely affected files/directories
lib/api/live.ts
lib/wallet/providers.tsx (SiweAuthContext)
components/admin-guard.tsx
Difficulty: Intermediate
Type: bug
Background
The README documents that "401 from backend shows inline re-auth banner without page redirect" as step 8 of the SIWE sign-in flow, implying admins can re-authenticate in place after a session expires.
Problem
After an admin re-authenticates via the inline banner, the mutation that originally triggered the 401 (e.g., a role assignment or policy update) is likely lost, forcing the admin to manually redo the action instead of it completing automatically once a valid session is restored.
Expected outcome
When a mutation fails with
401(viaAuthErrorfromlib/api/live.ts), the UI shows the re-auth banner, and upon successful re-authentication, the original mutation is automatically retried with the new token — with a clear success/failure toast either way.Suggested implementation
AuthErrorhandling path inlib/api/live.ts(or the calling hook) to capture the failed request's parameters before surfacing the re-auth banner.useSiweAuth()completes a successful re-auth, replay the captured request using the new token.Acceptance criteria
Likely affected files/directories
lib/api/live.tslib/wallet/providers.tsx(SiweAuthContext)components/admin-guard.tsx