-
Notifications
You must be signed in to change notification settings - Fork 936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSL error #298
Comments
Do you still stuck on it? I have a solution. |
Thanks for the answer. Do you have got an other solution? |
Same as you.😁 Bad certificate sucks. |
hi, my friends, can i share your solution, where could i add the OnReceivedSSlError and do you still use this webview plugin? i have the same question, but i just start to learn flutter app. |
@jessicaxxxxxxx Hello mate :) Solution goes here: import android.net.http.SslError;
import android.webkit.SslErrorHandler; Then line 85: webViewClient = new BrowserClient() {
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
handler.proceed();
}
}; |
@AlexVincent525 thanks for your quick reply. but it seems that you integrated flutter in a native android project, and i used this plugin in native flutter project, so my files are all .dart files, i can not find the above path and .java file. so do you have the same experences? |
Nope. My project is flutter native too. This file was not in your flutter project, it's a dart package which located in flutter sdk. |
hi, AlexVincent525 I got it, it was very useful for android, and i have tried to solve the problem for ios in the same way, but i failed, so could you do me a favor again? please |
@jessicaxxxxxxx Hi, plz paste your error message here, cause iOS might not facing this problem. |
@mohamedyaseen Hi, you haven't reached the android path. Right click on |
@jessicaxxxxxxx i had the same problem in iOS, i fixed it by adding the following code in FlutterWebviewPlugin.m `- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
}` |
It helped me. thanks man |
This solution works, but I don't like to change the source code this way. Is there another option? |
@fkranenburg what think would be to add this code to plugin as specify variable (it would be also good to add handler for those errors) other thing is - does it work on ios ? |
is anybody working on that? otherwise I could give it a try to add an option to ignore ssl certificate errors, maybe with some warning debug messages that this should not be a prodcution config. on your second question @charafau: |
Hi guys! You can use my plugin flutter_inappwebview. It has a lot of events, including events to manage SSL errors and SSL client certificate requests:
So, in your case, you need to use only the import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
Future main() async {
runApp(new MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: InAppWebViewPage()
);
}
}
class InAppWebViewPage extends StatefulWidget {
@override
_InAppWebViewPageState createState() => new _InAppWebViewPageState();
}
class _InAppWebViewPageState extends State<InAppWebViewPage> {
InAppWebViewController webView;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("InAppWebView")
),
body: Container(
child: Column(children: <Widget>[
Expanded(
child: Container(
child: InAppWebView(
initialUrl: "https://myUrl",
initialHeaders: {},
initialOptions: InAppWebViewWidgetOptions(
inAppWebViewOptions: InAppWebViewOptions(
debuggingEnabled: true,
),
),
onWebViewCreated: (InAppWebViewController controller) {
webView = controller;
},
onLoadStart: (InAppWebViewController controller, String url) {
},
onLoadStop: (InAppWebViewController controller, String url) {
},
onReceivedServerTrustAuthRequest: (InAppWebViewController controller, ServerTrustChallenge challenge) async {
return ServerTrustAuthResponse(action: ServerTrustAuthResponseAction.PROCEED);
},
),
),
),
]))
);
}
} where |
Hello, it's working fine in Android. However, it's only white screen in IOS. Can you please share how to handle it in IOS using the flutter_inappwebview? |
My Solution
Now it's working in iOS. |
Hay,
i'm having a xamp server on a machine with a self signed certificate.
I need to login to the website but because of the ssl the website is white.
`
@OverRide
void initState() {
super.initState();
final flutterWebviewPlugin = new FlutterWebviewPlugin();
flutterWebviewPlugin.onHttpError.skip(1000);
flutterWebviewPlugin.launch("https url to website", hidden: true, allowFileURLs: true, appCacheEnabled: true,withJavascript: true, withLocalStorage: true, withZoom: true);
}
`
Is there a way to catch up the ssl error "Failed to validate the certificate chain, error: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found." and ignore it?
The text was updated successfully, but these errors were encountered: