jnschulze / flutter-webview-windows

A WebView2-powered Flutter WebView implementation for the Windows platform.
BSD 3-Clause "New" or "Revised" License
203 stars 120 forks source link

how to set self-signed certificate or ignor self-signed certificate error? #227

Closed NickYoung-max closed 1 year ago

NickYoung-max commented 1 year ago

we need to use self-signed certificate to load a webview,but it's failed. when I go to the package file: -----webview.cc ------ to add addServerCertificateErrorDetected method to webview ,it shows build error :'add_ServerCertificateErrorDetected': is not a member of 'ICoreWebView2', how can I could handle the certificte error?

webview_windows: 0.2.0

NickYoung-max commented 1 year ago

code below work:

wil::com_ptr webview2_14; webview214 = webview.query(); webview2_14->add_ServerCertificateErrorDetected( Callback( [this]( ICoreWebView2 sender, ICoreWebView2ServerCertificateErrorDetectedEventArgs args){ args->put_Action(COREWEBVIEW2_SERVER_CERTIFICATE_ERROR_ACTION_ALWAYS_ALLOW); return S_OK; }) .Get(), &eventregistrations.server_certificate_error_detectedtoken) ;

NickYoung-max commented 1 year ago

ICoreWebView2_14 can add_ServerCertificateErrorDetected method.