Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get rid of SSL verification in Cordova in app browser

I am building a web and hybrid mobile app. The apps communicate with third party service using ssl self-sign cert in staging env. Desktop browsers allow to accept invalid cert with risk warning but in iOS app I got this error

Failed to load resource: The certificate for this server is invalid. You might be connecting to a server that is pretending to be "xxx" which could put your confidential information at risk.

I understand the risk but as my third party provider can not provide valid ssl cert for the service in staging server so I have no choice.

Is there any configs/possibilities to allow invalid ssl cert in iOS and android inappbrowser plugin.

Really appreciate your help.

like image 546
channa ly Avatar asked Aug 10 '16 02:08

channa ly


1 Answers

Thanks @Levi Murray.

For Capacitor 2.2.0, you need to tweak @Levi Murray answer.

Android - node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/BridgeWebViewClient.java

Add the override method with the other methods.

    ....
    @Override
    public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
      handler.proceed();
      return;
    }
like image 137
Abdul Fatir Avatar answered Sep 24 '22 07:09

Abdul Fatir