onReceivedServerTrustAuthRequest method
FutureOr<ServerTrustAuthResponse?> ?
onReceivedServerTrustAuthRequest(
- ServerTrustChallenge challenge
inherited
Event fired when the WebView need to perform server trust authentication (certificate validation).
The host application must return either ServerTrustAuthResponse instance with ServerTrustAuthResponseAction.CANCEL or ServerTrustAuthResponseAction.PROCEED.
challenge contains data about host, port, protocol, realm, etc. as specified in the ServerTrustChallenge.
NOTE for iOS and macOS: to override the certificate verification logic, you have to provide ATS (App Transport Security) exceptions in your iOS/macOS Info.plist.
See NSAppTransportSecurity in the Information Property List Key Reference
for details.
Officially Supported Platforms/Implementations:
- Android native WebView (Official API - WebViewClient.onReceivedSslError)
- iOS (Official API - WKNavigationDelegate.webView)
- MacOS (Official API - WKNavigationDelegate.webView)
- Windows (Official API - ICoreWebView2_14.add_ServerCertificateErrorDetected)
Implementation
@override
FutureOr<ServerTrustAuthResponse?>? onReceivedServerTrustAuthRequest(
ServerTrustChallenge challenge) {
return null;
}