Skip to content

Implement Token Refresh Instead of Deleting the Token on 401 #3

Description

@maugauwi-hash

Labels: enhancement, ios, security
Priority: High
Estimated Time: 2 hours

Description:
AuthToken.expiresAt (Models.swift:38-41) is decoded but never read anywhere in the iOS app.
APIClient.execute() (APIClient.swift:189-193) reacts to a 401 by deleting the stored token and
forcing a full re-authentication, even though a proactive refresh before expiry would avoid
interrupting the user mid-task (e.g., mid check-in).

Tasks:

  • Add a POST /auth/refresh-style call to APIClient (coordinate with the shared contract, see Document the WebSocket Message Schema #129-area docs)
  • Schedule a refresh timer against AuthToken.expiresAt in AuthStore
  • Fall back to the current delete-and-reauth behavior only when refresh itself fails
  • Add tests for "token near expiry" and "refresh fails" paths

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions