Start a new topic

Log out clearing the data store cache


Log out clearing the data store cache. In our app we need to display some questions before displaying the login page. For those questionaries data, we are maintaining in the store. If access questionaries collections after log out it's throwing NoActiveUserError.

Please help me out with the solution.

1 Comment

Hi Revathi,

Logging out a user will always clear the datastore cache. You will always need an active user for calling different methods. If you try to access any collection after log out then you will get "NoActiveUserError" error because log out clears the active user and all related data, preventing other app users from accessing it. The deleted data includes:  

  • Cached tokens
  • User attributes
  • DataStore caches
  • Offline data pending to be written to the backend

Keep the following considerations in mind when using logout:  

  • If your app needs to persist pending offline data, remember to push or sync the user's changes before logout.

  • To persist any user attributes that were modified after the last update, save the user before logout.

  • Recreate any DataStore instances used by your app after the user logs in again. DataStore instances maintain references to cache files which get destroyed on logout. Attempts to reuse the same instance of a DataStore may result in unexpected behavior.

  • If the user was subscribed to the live service, they will be unsubscribed on logout. You will need to resubscribe the user to the live service, on a fresh login.

If you want to display some questions without logging in a user on Kinvey, I would suggest you store that data on small storage like UserDefaults on iOS or SharedPreferences on Android.

Please review this information and let me know if you have any additional questions.



Login or Signup to post a comment