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

256
Views
Traducción de solicitud Curl con datos de formulario a Axios

Estoy tratando de imitar la siguiente solicitud usando axios:

 curl -i -k --tlsv1.2 -H "Accept:application/json" -H "Content-Type:application/x-www-form-urlencoded" -d "client_id=YOUR_CLIENT_ID" -d "client_secret=YOUR_CLIENT_SECRET" -d "grant_type=refresh_token" -d "refresh_token=REFRESH_TOKEN_FROM_ACCESS_TOKEN_RESPONSE" -X POST https://api-sandbox.capitalone.com/oauth2/token

Más información: https://developer.capitalone.com/documentation/o-auth

Se me ocurrió el siguiente código:

 axios({method: 'post', url: 'https://api-sandbox.capitalone.com/oauth2/token', params: {client_id: '…', client_secret: '…', grant_type: 'refresh_token', refresh_token: '…'}, headers: {'Content-Type': 'aplication/x-www-form-urlencoded', Accept: 'application/json' }}).then(res => console.log(res)).catch(ex => console.log(ex))

Esto sigue agotando el tiempo y no me da ninguna respuesta, lo que me lleva a creer que mi solicitud tiene un formato incorrecto. ¿Estoy haciendo algo mal al intentar crear esta solicitud con datos de formulario usando axios?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Ver la documentación :

params son los parámetros de URL que se enviarán con la solicitud

Para enviar datos en el cuerpo, use body , no params y páselo como un objeto URLSearchParams , no como un objeto simple.

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!