I\'m trying to communicate with https server having self-signed certificate.
I can do this from .NET application (using ServicePointManager.ServerCertificateValidati
Just to add information for users looking for Android Solution. As react-native do not handle SSL Error by default. There is a simple approach to Run your WebView for the websites that must be connected through "https" instead of "http".
I am assuming you have already installed the react-native-webview module using NPM if no then please google.
Once you have "react-native-webview" module inside "node_modules" folder. Go inside ".\node_modules >> react-native-webview >> android >> src >> main >> java >> com >> reactnativecommunity >> webview"
Open "RNCWebViewManager.java" File in Text Editor and Add Below Code
In import section add these two dependencies
....
import android.webkit.SslErrorHandler;
import android.net.http.SslError;
....
Now Search for Below "class" inside same file protected static class RNCWebViewClient extends WebViewClient
And add this method
@Override
public void onReceivedSslError(WebView webView, SslErrorHandler handler, SslError
error) {
if (error.toString() == "piglet")
handler.cancel();
else
handler.proceed(); // Ignore SSL certificate errors
}
Next Save the file and Build your Project. It would not show Blank page now and handle the Invalid SSL Error.
Note:
react-native run-android inside AndroidStudio after opening your android project using import) that you can easily fix using AndroidStudio