can someone from the Capacitor Experts here possibly tell me which is the more persistent method for storing tokens? Capacitor Preferences or Capacitor Cookies?
Currently, I am using cookies which are patched via Capacitor. However, users sometimes report that they are logged out when they haven’t used the app for a while.
I’m currently evaluating if it’s the cookies or possibly something else. Has anyone had similar problems?
It’s the cookies, use Cap Preferences instead. More info here:
We use preferences in our PWA and they work great for long term storage in the app.
Capacitor Cookies is only intended to be used to work with web systems. You should absolutely rely on Capacitor preferences for storing data in your application.
I would add this to the documentation: Capacitor Cookies Plugin API | Capacitor Documentation
My impression was that is can be safely used in native apps, based on the fact it’s official plugin, mention about Third Party Cookies on iOS and no warning about using it in native apps.
Yes, for me too! Why is there a CapacitorCookies plugin if it’s not meant to be used with Capacitor? Some examples of how to use the plugin would be helpful. @dallas