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

255
Views
¿Cómo hacer una solicitud de curl POST/GET con autenticación de token?

Tengo la descripción APIKeyHeader

Api está hecho con FastApi.

He intentado diferentes maneras como

 curl -X GET -H "X-Access-Token: <token>" "https://example/v1/method/" curl -X GET "https://example/v1/method/" --header '{"X-Access-Token": "token"}'

Y la respuesta es la misma: {"detalle": "No se pudieron validar las credenciales"} pero sé que el token es correcto.

PD: nuevo en curl, ¿podría describir mi error en detalle?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Puedes usar

curl -X GET "https://example/v1/method/" -H "Authorization: Bearer TOKEN_HERE"

Supongamos que tengo un punto final /users/me , si envío una solicitud HTTP a ese punto final con el comando cURL anterior.

 curl -X GET "http://127.0.0.1:8000/users/me" -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMDY1ODQwNDEtYzYwYi00NDg4LWEyYzctZmRkZmQxNWI0NDNkIiwiYXVkIjoiZmFzdGFwaS11c2VyczphdXRoIiwiZXhwIjoxNTk1NzA3ODYyfQ.yutytBX0hmv0MJy5BMSfGSBqrPvFzKqLq_-quEgNyF4"

Funciona perfectamente.

 Out: {"id":"06584041-c60b-4488-a2c7-fddfd15b443d","email":"user@gmail.com","is_active":true,"is_superuser":false}
over 4 years ago · Santiago Trujillo 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!