[Android-development] Handling WebView certificate errors and cookies

Sandro Andrade sandroandrade at kde.org
Tue Dec 3 21:24:12 CET 2019


Hi there,

I'm developing an Android application which integrates to a legacy
website and, for that, I need to use WebView QML element to access a
login page. The problem is that the website uses a certificate issued
by an unknown CA and I'm getting an "ERR_CERT_AUTHORITY_INVALID"
error, for example, when using the minibrowser example.

I managed to handle that with WebEngineView by using
"onCertificateError: error.ignoreCertificateError()" and with QWebView
by installing a custom networkaccessmanager which creates
QNetworkRequests with QSslSocket::VerifyNone for its SSL peer verify
mode. Unfortunately, none of those seems to work on Android :(

So, my questions currently are:

1) Is there any way to change the SSL configuration for requests
created by WebView or handle/bypass certificate errors?

2) Once this is solved, is there any way to reuse the cookies produced
by WebView with a QNetworkAccessManager instance to make future HTTP
requests?

3) In case of 1 and 2 not being feasible, any other hints about how to
overcome that?

Thanks in advance,
--
Sandro


More information about the Android-development mailing list