【问题标题】:React-native : self-signed certification implementationReact-native : 自签名认证实现
【发布时间】:2021-05-08 02:11:08
【问题描述】:

您知道在 react-native 应用中如何正确地使用 自签名认证 进行 fetch 调用 吗?

使用经典抓取:

TypeError: Request failed

使用rn-fetch-blob 获取:

[Error: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.]

一个正常工作的解决方案是忽略认证,但这当然不安全。

此代码位于index.js 文件应用程序中。

const Fetch = RNFetchBlob.polyfill.Fetch
window.fetch = new Fetch({
  trusty: true
}).build()

我查看了另一个帖子,例如 this

【问题讨论】:

    标签: react-native ssl fetch self-signed-certificate rn-fetch-blob


    【解决方案1】:

    我使用react-native-ssl-pinning,它可以与证书固定一起正常工作。

    真正的问题是服务器证书安装错误。

    【讨论】:

      猜你喜欢
      • 2018-11-26
      • 2017-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多