Skip to content
Back

Implementing Offline Login Caching with Appwrite in a Flutter App

  • 0
  • Auth
  • Flutter
  • Cloud
borg_1of3
8 Jul, 2025, 19:58

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!

TL;DR
Developers seek guidance on implementing offline login caching with Appwrite in a Flutter app. The proposed workaround involves caching the JWT token locally and using it to check for an active session in offline mode. This approach is recommended for offline login caching with Appwrite in case there's no built-in feature available.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more