Search code examples
react-nativesslfetchself-signed-certificatern-fetch-blob

React-native : self-signed certification implementation


Do you known how properly work a fetch call with a self-signed certification in react-native app ?

With a classic fetch :

TypeError: Request failed

With a rn-fetch-blob fetch :

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

And a solution to work fine is to ignore the certification, but of course it's not secure.

This code is place on index.js file app.

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

I check a different post like this !


Solution

  • I use react-native-ssl-pinning, it's work fine with Certificate pinning.

    And the real problem was coming from a bad install of server certificate.