4

I am working on an app that uses rest API to get it connected to a database and my server has an SSL certificate and from my react native app when I am trying to send the request it shows this error msg is there is a way to disable SSL verification in react native for android.

If anyone knows, help.

2

1 Answer 1

2

This solution worked for me on Android:

install package : npm install --save rn-fetch-blob

and paste this code in your index.js

import RNFetchBlob from 'rn-fetch-blob';

AppRegistry.registerComponent(appName, () => App);
const Fetch = RNFetchBlob.polyfill.Fetch
  // replace built-in fetch
 window.fetch = new Fetch({
 // enable this option so that the response data conversion handled automatically
  auto : true,
  // when receiving response data, the module will match its Content-Type header
  // with strings in this array. If it contains any one of string in this array, 
 // the response body will be considered as binary data and the data will be stored
 // in file system instead of in memory.
 // By default, it only store response data to file system when Content-Type 
 // contains string `application/octet`.
  binaryContentTypes : [
  'image/',
  'video/',
  'audio/',
  'foo/',
   ],
   trusty : true
  }).build()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.