Hi,
I'm evaluating Appwrite for my Flutter app and need clarification on handling offline login sessions.
My app requires users to log in, with the session cached locally to allow offline access. Previously, I used Firebase Auth, which provided a local session cache. On app launch, I checked for a cached user and allowed offline app usage if present.
With Appwrite's Flutter SDK, I understand that Account.get() checks for an active user session but makes a backend call, which fails in offline mode. Is this correct, or am I missing a built-in offline session handling feature?
As a workaround, I'm considering the following approach:
After a successful login, cache the JWT token (or another user-specific property) locally. On app launch, attempt Account.get(). If it fails due to offline mode, check for the cached token. If present, assume an active session and allow offline access. When the app is online, validate the cached token by exchanging it for an active session or triggering a re-login if the session is invalid. Clear the cached token on logout or when an online check confirms no active session. Is this a recommended approach for offline login caching with Appwrite, or is there a better solution or built-in feature I should use?
Thank you for your guidance!
Recommended threads
- Team invite - 500 error - no email
When executing ```dart await _repository.teams.createMembership( teamId: event.listId, roles: ['member'], email: event.email, url: 'xxxx', ); ``` I se...
- Appwrite Function getting general_unauth...
Hi everyone, I'm trying to create a database schema using an Appwrite Function written in Dart from Appwrite console, but I'm getting an authorization error wh...
- Help with nameservers
I just added our domain, and as per instruction in the page following, it says, "Add the following nameservers on your DNS provider. ..." I want to keep my cu...