History of gotchas/background-tracking-token-synchronization.md
1 version, newest first. Superseded versions stay in the record; nothing here can change them.
Content of 3d91e438 (no earlier version at this path)
Keep refreshed authentication tokens synchronized with background tracking storage
@@ -0,0 +1,7 @@+# Keep refreshed authentication tokens synchronized with background tracking storage++Background location tracking may run outside the normal foreground request flow and read its bearer credentials from `SharedPreferences`. When the authenticated HTTP client refreshes an expired token, update the tracking copy of the access token—and refresh token when available—in the same successful refresh path as secure storage.++Otherwise, foreground API requests can recover from a 401 while the background tracking isolate continues using stale credentials and queues otherwise valid location points offline.++The tracking start path should also persist the current access and refresh credentials before launching tracking. Token persistence failures should not make the foreground refresh fail, but should be observable through logging or diagnostics where practical.