Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

192
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda