首页 > 解决方案 > 颤振中的 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());
}

标签: fluttersslabp

解决方案


推荐阅读