react-native axios https请求证书问题

react-native axios https请求证书问题,第1张

概述react-native使用axios请求后台服务,Android9报错如下{UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4,readyState:4,status:0,timeout:30000,withCredentials:true,

react-native使用axios请求后台服务,AndroID9报错如下

{ UNSENT: 0,         OPENED: 1,         headerS_RECEIVED: 2,         LOADING: 3,         DONE: 4,         readyState: 4,         status: 0,         timeout: 30000,         withCredentials: true,         upload: {},         _aborted: false,         _hasError: true,         _method: 'POST',         _response: 'java.security.cert.CertPathValIDatorException: Trust anchor for certification path not found.',         _url: 'xxxxxxxxxxxx',         _timedOut: false,         _trackingname: 'unkNown',         _incrementalEvents: false,         responseheaders: undefined,         _requestID: null,         _cachedResponse: undefined,         _headers: { 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8' },         _responseType: '',         _sent: true,         _lowerCaseResponseheaders: {},         _subscriptions: [] },      response: undefined,      isAxiosError: true,      toJsON: [Function: toJsON],      line: 120970,      column: 26,      sourceURL: 'http://172.31.52.97:8081/index.bundle?platform=androID&dev=true&Minify=false' }

Android10报错如下

_method: 'POST',_response: 'Unacceptable certificate: CN=DigiCert Global Root CA, OU=www.digicert.com, O=DigiCert Inc, C=US',

证书本来是ca证书的,这个坑在于之前的同事在AndroID的AndroIDManifest.xml文件中配置的androID:networkSecurityConfig配置了这个域名的证书为自签名证书,如下

 

配置的说明参照谷歌的官方文档:https://developer.android.google.cn/training/articles/security-config#domain-config

 

总结

以上是内存溢出为你收集整理的react-native axios https请求证书问题全部内容,希望文章能够帮你解决react-native axios https请求证书问题所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1035854.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存