Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
Network request failed in react-native and expo

I have a flask server running on docker container. And it runs on port 5000 in container. I've mapped this docker container to my localhost:5000 port. I can display it on my browser so it works.

Now I want to send POST Request to that server endpoint /auth using fetch() in react native.

Here what I've tried so far:

 fetch("https://160.75.195.68:5000/auth",
          {
            method: 'POST',
            body: JSON.stringify({
                phone: phone,
                password: password
            }),
            headers: {
              "Content-Type": "application/json"
            }
          }
          ).then((response) => {
            console.log("RETURNED RESPONSE")
            console.log(response.data);
            deviceStorage.saveKey("id_token", response.data.access_token);
            deviceStorage.loadJWT(response.data.jwt);
            // this.props.newJWT(response.data.jwt);
          }).catch((error) => {
            if (error.response) {
              // There is an error response from the server
              // You can anticipate error.response.data here
              console.log("THERE IS AN ERROR RESPONSE FROM THE SERVER")
              const error = err.response.data;
              dispatch(addError(error.message));
            } else if (error.request) {
                // The request was made but no response was received
                // Error details are stored in error.reqeust
                console.log("THE REQUEST WAS MADE BUT NO RESPONSE WAS RECEIVED");
                console.log(error.request);
            } else {
                // Some other errors
                console.log("SOME OTHER ERRORS");
                console.log('Error', error.message);
            }
          })

But I get Network request failed. Please help!!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!