Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1498

How to ignore SSL issues in axios using React Native?

$
0
0

Hi I'm currently working with react native on Android with Expo. I am trying to send requests to my server which has a valid ssl certificate, but for some reason axios takes it as invalid, so axios does not allow me to send requests to my server's api.

this is the error i get:

Error: Network Error

So I wonder if there is any way to make axios ignore the problem with the ssl and can send the requests in a normal way

this is my code:

  try {        const headers = {'Accept-Language': 'es-ES,es;q=0.8',"Content-Type": "application/x-www-form-urlencoded","Accept": "application/json",        };        axios.get("https://URLtoMySERVER", {}, headers)        .then(response => {             console.log(response)             const posts = response.data;             console.log(posts)}        ).catch(function(error) {             console.log("error", error);        }); } catch (error) {        console.log('err', error);   }

some points that I want to clarify:

1- I can't use RNFetchBlob because I'm using Expo, and RNFetchBlob have some native libraries.

2- I can't use httpsAgent either with axios because apparently https library does not work with expo, or at least it does not work for me.

3- fetch doesn't work either

Is there any other alternative to axios or fetch that works in react native with expo and where you can ignore the problems of https?


Viewing all articles
Browse latest Browse all 1498

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>