Keychain Plugin


#1

I requires to add “Keychain” plugin in the project.

After I add the plugin with the following command, and add the sample code, there is an error that says Cannot find variable “Keychain”

Command: cordova plugin add https://github.com/shazron/KeychainPlugin.git
Sample code:
$cordovaKeychain.setForKey(key, serviceName, value).then(function(value) {
console.log(value);
}, function (err) {
console.error(err);
});

Error:

0 702526 error Error: Can’t find variable: Keychain
setForKey@http://10.70.153.147:8100/lib/ngCordova/dist/ng-cordova.js:4133:30
setKeychainValue@http://10.70.153.147:8100/js/keychain.js:7:30

Anyone has similar experience can advise?

Appreciate a lot!


#2

Anyone has idea about this?


#3

// Get a reference to the plugin first
var kc = new Keychain();

kc.setForKey(successCallback, failureCallback, ‘key’, ‘servicename’, ‘value’);


#4

Thank you sir.

I already add the cordova plugin https://github.com/shazron/KeychainPlugin.git
And the error happens in ng-cordova.js

Do you suggest me to use the plugin directly instead of using ng-cordova as a wrapper?


#5

Any developer from ionic can help to take a look? Appreciate a lot!!