Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

191
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda