I need help please, I am using this plugin https://ionicframework.com/docs/native/keychain-touch-id for fingerprint and face ID, using the example code, it works on android, however on IOS I am getting an error Password could not be save in chain
my angular code looks like
await this.keychainTouchId.isAvailable().then((res: any) => {
console.log(res); `// res = true`
this.keychainTouchId.save('refresh_token', credentials, true).then((result: any) => {
console.log(result);` // result = Password could not be save in chain`
return result;
}).catch((err: any) => {
console.log('key save error ' + err)
return err;
});
I believe this might be broken because i created cordova app project just to test it, using the example code in https://github.com/sjhoeksma/cordova-plugin-keychain-touch-id the fingerprint dialog shows on ios. So I am left really confused.
Is the an issue with the ionic-native library?
Try removing the third parameter in save method call, this method have 2 parameters only, and the error message you have is a generic catch in this method.
Hi, first of all thanks for looking at this question.,
I tried it has shown in the example code in ionic.it shows an error. looking at the save method it has this extra argument userAuthenticationRequired doesn’t seem to be optional.
thanks again. i downgraded to that version however, when i run the app when it gets to the part that calls .save method. The app force closes. I am looking to find an alternative. You have any suggestions?
looks good, but I’m not sure about the return in set method, it’s promise, but I never use it return before. If you want to get the saved data use the get method after set the data.
About async/await, don’t get me wrong, I use it all time, but for platform ready never, I prefer use then catch notation for it.
ionic cordova plugin add cordova-plugin-keychain-touch-id is installing old version of the code which doesn’t have userAuthenticationRequired needed to install the one directly from the git repo which is ionic cordova plugin add https://github.com/sjhoeksma/cordova-plugin-keychain-touch-id this might solve your issue also so you can use the latest version
2020-04-04 17:02:26.514607+0100 HelloWorld[3422:896268] THREAD WARNING: [‘TouchID’] took ‘21.125977’ ms. Plugin should use a background thread.
2020-04-04 17:02:26.529443+0100 HelloWorld[3422:896522] [access] This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSFaceIDUsageDescription key with a string value explaining to the user how the app uses this data.