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

190
Views
Fetch Post Request with Parameters is returning 400 status code?

I have a Post Request using fetch in react native, but I get a status code 400 for this, what is wrong with the code?

function sendRequest2() {
    fetch(`https://sandbox-api.dexcom.com/v2/oauth2/token`, {
      method: "POST",
      headers: {
        "Content-Type": "application/x-www-form-urlencoded",
      },
      body: JSON.stringify({
        code: "value1",
        client_id: "value2",
        client_secret: "value3",
        redirect_uri: "http://www.google.com",
        grant_type: "authorization_code",
      }),
    })
      .then((response) => {
        response.json();
      })
      .then((data) => {
        console.log(data);
      })
      .catch((err) => console.log("The error is: " + err));
  }
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Check your content-type, replace it by :

headers: {
    "Content-Type": "application/json",
  },

helpfull link : application/x-www-form-urlencoded or multipart/form-data?

about 4 years ago · Juan Pablo Isaza Report

0

You can try by removing JSON.stringify

That would solve the issue

Moreover you have shared a lot of open information regarding your server openly.

You must either hide it or add some dummy values. Sharing such a secure data openly is not recommended in open community.

about 4 years ago · Juan Pablo Isaza Report
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!