flutter - 颤振中的 SSLHandshakeException
问题描述
我正在尝试将我的颤振应用程序连接到 Abp 后端项目我按照 abp.io 社区示例中的步骤进行身份验证,git hub https://github.com/Znow/ConsumeAbpFromFlutterApp上的完整代码 ,但我面对这个例外
E/AppAuth ( 7748): Network error when retrieving discovery document
E/AppAuth ( 7748): javax.net.ssl.SSLHandshakeException:
java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
我试图在 main.dart 中添加这段代码,但它也不起作用
class MyHttpOverrides extends HttpOverrides {
@override
HttpClient createHttpClient(SecurityContext context) {
return super.createHttpClient(context)
..badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
}
}
void main() {
HttpOverrides.global = new MyHttpOverrides();
runApp(MyApp());
}
解决方案
推荐阅读
- php - Illuminate\Database\QueryException:找不到驱动程序错误
- java - 编译java时如何抑制Cannot Find Symbol错误?
- javascript - 如何在 Node 服务器中提供带有散列名称的捆绑 js 文件?
- css - 如何在桌面和角度材料表行中的响应视图中进行不同的操作?
- java - 在字符串声明中使用算术运算符时会发生什么?
- java - xml的xpath正则表达式
- unix - 使用 awk 解析分隔字符串并获取匹配的字符串
- reactjs - 如何在 reacttable 中添加数据格式和打印数据?
- javascript - 需要在使用 Google Cloud Function 进行 HTTP 发布请求时为我的 URL 添加值
- angular - FormGroup 指令