SecureStorage does not work in browser


In the docs the browser is listed as supported platform of SecureStorage.


But when I add the following code to my app, it won’t work anymore and an error is thrown:
Can't find variable : Cordova

let secureStorage: SecureStorage = new SecureStorage();
   () => console.log('Storage is ready!'),
   error => console.log(error)

Are the docs wrong or is SecureStorage broken?


How are you running it in the browser? With ionic serve or with ionic run browser?

ionic serve

The other command isn’t mentioned in the docs, as far as I can see.


That explains it then. Cordova and therefore Cordova plugins are not available when running with ionic serve.

When a Cordova plugin says it supports the “browser” that really means the Cordova browser platform. You can add it to your project like any other platform:

ionic platform add browser
ionic run browser


Thank you very much for the clarification!