Ti.Cloud.currentUser() returns null when offline – how to preserve session for low‑traffic workloads?
0 reputation · 21 Feb 2022, 00:19 UTC
Ti.Cloud.currentUser() returns null when offline
The goal is to understand why the Cloud Services API returns null for Ti.Cloud.currentUser() after a device loses connectivity, even though a user had previously authenticated. This behavior is observed in SDK versions 7.0.0 and later, but the documentation does not specify whether a cached user should be returned in offline mode.
For low‑traffic workloads that aim to reduce Cloud costs, developers rely on local persistence and minimal API calls. An unexpected null value can break authentication logic and force unnecessary re‑authentication, thereby increasing API usage and cost.
Key constraints and uncertainties:
- Does the SDK intentionally clear the cached user when the network is unavailable?
- Are there platform‑specific differences between iOS and Android implementations?
- Is there a documented callback, event, or configuration that restores the user state offline?
Specific questions to investigate:
- Is the null result from
Ti.Cloud.currentUser()when offline expected behavior according to the SDK design? - Do iOS and Android builds differ in how they cache or return the current user during offline mode?
- What, if any, mechanism is available or planned to restore a previously authenticated session without network access?