         }else {
           // Check if there is an error
           if let error = error {
-            //TODO error result
-            print(error.code);
-            pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAsString: "Error");
+            let erroCode = String(error.code);
+            pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAsString: "Error: \(errorCode)");
           }
         }
       });

    var reason = "Authentication";

    do {
      let json = try NSJSONSerialization.JSONObjectWithData(data, options: .AllowFragments)
      if let clientId = json["clientId"] as? String {
        reason = clientId;
      }
    } catch {
      print("error serializing JSON: \(error)")
    }

    authenticationContext.evaluatePolicy(


  func isAvailable(command: CDVInvokedUrlCommand){
    let authenticationContext = LAContext();
    var error:NSError?;

    let available = authenticationContext.canEvaluatePolicy(.DeviceOwnerAuthenticationWithBiometrics, error: &error);

    var pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAsString: "Not available");
    if available == true {
      pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAsString: "Available");
    }

    commandDelegate.sendPluginResult(pluginResult, callbackId:command.callbackId);
  }

