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

86
Views
Discord api obtener gremio

Estoy tratando de obtener la información de mi gremio de la API de discord

 fetch('https://discord.com/api/guilds/772037458996101140', { headers: { authorization: 'bot Nzc******zNjYzOTAz.GPwhCV.rhIcH****5R8ZS-cIo4MjPcBVxO6wYsUXhY' }, }) .then(result => result.json()) .then(response => { console.log(response); }) .catch(console.error)

solo recibiendo 401 (no autorizado)

Intenté cambiar "bot" a "BOT", "Bot", "Bearer" y hacer la autorización usando el token de acceso de Oauth2

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

El problema radica en cómo se ha especificado el encabezado de Autorización. La forma correcta de especificar headers sería:

 fetch('https://discord.com/api/guilds/772037458996101140', { withCredentials: true, credentials: 'include', headers: { 'Authorization': 'bot Nzc******zNjYzOTAz.GPwhCV.rhIcH****5R8ZS-cIo4MjPcBVxO6wYsUXhY', }, }) .then(result => result.json()) .then(response => { console.log(response); }) .catch(console.error)

Espero que esto ayude.

Editar

También se agregaron withCredentials crendentials esta respuesta .

about 4 years ago · Santiago Trujillo Report

0

Estaba enviando una solicitud http desde el front-end y cuando lo moví al back-end o simplemente usé el archivo de prueba de python, funcionó usando: Authorization: 'Bot <TOKEN>'

No estoy seguro de por qué, pero funciona como debería, ¿alguien puede explicarlo?

about 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!