I’ve found two solutions for SSL pinning in ionic mobile apps (https://github.com/EddyVerbruggen/SSLCertificateChecker-PhoneGap-Plugin and https://github.com/wymsee/cordova-HTTP) and not much else in terms of people writing ionic apps actually using them. I’m trying the above Eddy plugin in ionic 2. Base functionality works. When I add my code to the functions, I get the below error and not sure what it means. Anyone have experience with this plugin and/or know what I’m doing wrong?
Error:
Error in Error callbackId: SSLCertificateChecker1359693488 : TypeError: null is not an object (evaluating 'this.getFriends’)
My Code being called in constructor:
checker(){
window["plugins"].sslCertificateChecker.check(
successCallback,
errorCallback,
this.server,
this.fingerprint);
function successCallback(message) {
// Message is always: CONNECTION_SECURE.
console.log("cert success");
// Now do something with the trusted server.
this.getFriends(); //https get call
}
function errorCallback(message) {
console.log("cert fail");
this.showErrorToast(); //show toast with bad news
}
}
}