What is SSL (Secure Socket Layer) Pinning In Ionic V3?

Share the post

Hello All, In this topic we will learn What is SSL (Secure Socket Layer) Pinning In Ionic V3.

What is SSL (Secure Socket Layer) Pinning In Ionic V3

In the last tutorial, We learned about What is SSL (Secure Socket Layer) Pinning In Ionic V3 ?. Now we go through implementation in Ionic 3.

Follow the below steps to implement SSL Pinning in Ionic 3.

Step 1: Copy certificate to app/src/main/assets/www/certificates/certificatename.cer

Step 2: Install Ionic Cordova Native Plugin

ionic cordova plugin add cordova-plugin-advanced-http
npm install --save @ionic-native/http@4

Step 3: import this plugin to app.module.ts

Step 4: In Platform ready paste the below code



 this.http.setSSLCertMode(‘pinned’)

 .then(() => {

 console.log(‘Pinning Success’);

 })

 .catch(() => {

 console.log(‘Pinning Fails’);

 });

Step 5: Open config.xml

write under platform tag


resource-file src="src/certificate/certificatename.cer"
target="app/src/main/assets/www/certificates/certificatename.cer"


That’s it. If getting console Pinning Success then you can now communicate securely with your trusted server.

Leave a Comment