Secure Storage: Device is not secure

I’m trying to use the Secure Storage plugin like shown in the docs. After putting the following lines in app.component.ts in the platform.ready().then…-block

this.secureStorage.create('my_store_name')
  .then((storage: SecureStorageObject) => {
    console.log('secureStorage created!');
    console.log(storage);
  })

I’m getting the following error by testing on a Samsung Note 4:

ERROR Error: Uncaught (in promise): Error: Device is not secure
Error: Device is not secure
at g (polyfills.js:3)
at fail (securestorage.js:71)
at Object.callbackFromNative (cordova.js:295)
at processMessage (cordova.js:1119)
at processMessages (cordova.js:1142)
at t.invoke (polyfills.js:3)
at Object.onInvoke (core.es5.js:4145)
at t.invoke (polyfills.js:3)
at n.run (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (core.es5.js:4136)
at t.invokeTask (polyfills.js:3)
at n.runTask (polyfills.js:3)
at a (polyfills.js:3)
at g (polyfills.js:3)
at fail (securestorage.js:71)
at Object.callbackFromNative (cordova.js:295)
at processMessage (cordova.js:1119)
at processMessages (cordova.js:1142)
at t.invoke (polyfills.js:3)
at Object.onInvoke (core.es5.js:4145)
at t.invoke (polyfills.js:3)
at n.run (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (core.es5.js:4136)
at t.invokeTask (polyfills.js:3)
at n.runTask (polyfills.js:3)
at a (polyfills.js:3)
at g (polyfills.js:3)
at l (polyfills.js:3)
at l (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (core.es5.js:4136)
at t.invokeTask (polyfills.js:3)
at n.runTask (polyfills.js:3)
at a (polyfills.js:3)

defaultErrorLogger @ core.es5.js:1085
ErrorHandler.handleError @ core.es5.js:1145
IonicErrorHandler.handleError @ ionic-error-handler.js:63
next @ core.es5.js:4774
schedulerFn @ core.es5.js:3848
SafeSubscriber.__tryOrUnsub @ Subscriber.js:234
SafeSubscriber.next @ Subscriber.js:183
Subscriber._next @ Subscriber.js:125
Subscriber.next @ Subscriber.js:89
Subject.next @ Subject.js:55
EventEmitter.emit @ core.es5.js:3834
NgZone.triggerError @ core.es5.js:4205
onHandleError @ core.es5.js:4166
t.handleError @ polyfills.js:3
n.runGuarded @ polyfills.js:3
r @ polyfills.js:3
a @ polyfills.js:3

Can you help me?

Does your device and setup fulfill the requirements?
https://github.com/Crypho/cordova-plugin-secure-storage#users-must-have-a-secure-screen-lock-set

1 Like

Thanks, that was the problem. I haven’t read about this requirement.