Ionic and KeychainPlugin problems


Anyone out there who has used the plugin called KeychainPlugin ( in their Ionic-app with success?

I tried adding the plugin to my Ionic-app yesterday but I couldn’t get it to work. The documentation of this plugin is quite sparse. I’ve added lots of plugins from the site before with success, but this one… just won’t get it to work.

According to the plugin should be added and accessed in the following way:

module.controller(‘MyCtrl’, function($scope, $cordovaKeychain) {

$scope.getValueFromKey = function(key) {
$cordovaKeychain.getForKey(key, servicename).then(function(value) {
}, function (err) {


But as soon as I add $cordovaKeychain to the module declaration (first row) the the app will halt running in Xcode.

I’ve tried excluding the $cordovaKeychain from the module declaration, and just go with the example code for the keychainplugin on github and doing:

//This works
var kc = new Keychain();

//But this doesn’t work, when I add this row, the app will halt in Xcode
kc.getForKey(win, fail, “some_key”, “some_servicename”);

Any clues anyone?

No one out there who has used the keychain-plugin?

I tried to use it, but it is not working. Wasted a whole day debugging it.
I followed the below guideline:

If anyone has a Keychain working example for ionic, please post it.

I could get other plugin (e.g. ngGeolocation) working but not the Keychain.

You dont even need to run it on iOS to prove it does not work.
Just do ionic serve, and the browser will complain Keychain undefined (in the ng-cordova.js).

Stumbled upon the same issue. Here is a fix

Thanks for posting the fix. I encountered the same issues and the fix worked.

Hi Sir,
May I know how you fixed the problem? Could you share? Appreciate

Still its not working , i tried to run app on browser as well on device it shows keychain not defined. Can you guys put a working example for your fix?