Ionic V6 - Storage a session

I want to keep the user data in the device storage in order to let him keep the session open. I have read some documentation and I have noticed that this is from Ionic v3. I am using Ionic v6 and I would like to know the recommended way to do this.

I have tried to import IonicStorageModule but I get this error:

TS2305: Module ‘"@ionic/storage"’ has no exported member ‘IonicStorageModule’.

That’s why I think this is not supported in the newest version.

I think I have found the solution in this page

There are 2 ways:

  • Ionic Secure Storage
  • @ionic/storage

check GitHub - ionic-team/ionic-storage: Ionic Storage module for Ionic apps

If using Angular, install the @ionic/storage-angular library instead:

npm install @ionic/storage-angular

Have you thought about using Capacitor Storage?

I don’t believe Capacitor Storage degrades to IndexedDB for PWA support. localStorage should not be used for anything.

Can you break down the differences between @ionic/storage and @capacitor/storage?