HTTP Requests with React-Native do not work on Android

0

I commented that when working with requests to the server using Fetch and also using Axios , when running on android it shows me the following error:

fetch(URL,{
      method: 'POST',
      headers: {
        Accept: 'application/json',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
                email: userEmail,
                password: userPassword
            }),

        })
        .then((response) => response.json())
         .then((responseJson)=>{
             Alert.alert("bien");
       console.warn(responseJson);
             })
         .catch((error)=>{
         console.error(error);
     console.warn(error);
   });

It is not the server since the api is already used for other types of applications, and in iOS works perfectly

    
asked by mariovzc 22.02.2018 в 16:14
source

1 answer

0

Fixed, The problem was with the SSL certificate of the url.

According to the android documentation: link in the section "Common Verification Issues server certificates ", in the sub-topic: Lack of intermediate certification authority", which did not allow access to the api.

    
answered by 23.02.2018 / 22:56
source