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

180
Vistas
Creating tickets using Zendesk api with React

I working on intergrating a react app with the zendesk api for creating support tickets. Till now i have completed the form flow, but when i making the request to the zendesk api i am getting 401. I am using the api_key approach for this. I am fairly new to zendesk, if anyone can help me regarding that. Here is my code after user clicks submit.

const onSubmit = async () => {
    try {
      console.log('setInfo', info)
      const data = { request: { subject: 'test', comment: { body: 'testdesc' } } }

      const user = 'test@test.com'
      const api_token = 'some_api_key'
      const url = 'https://url.zendesk.com/api/v2/tickets.json'    

      const response = await fetch(url, {
        method: 'POST', // *GET, POST, PUT, DELETE, etc.
        mode: 'no-cors',
        headers: {
          'Content-Type': 'application/json',
          Authorization: api_token,

          // 'Content-Type': 'application/x-www-form-urlencoded',
        },
        body: JSON.stringify(data), // body data type must match "Content-Type" header
      })

      console.log('respone', response)
    } catch (error) {
      console.log('respone error', error)
    }
  }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It looks like you're not sending the right authorization header. According to Zendesk API reference you need to use the following format for the credentials:

{email_address}/token:{api_token}

Example:

jdoe@example.com/token:6wiIBWbGkBMo1mRDMuVwkw1EPsNkeUj95PIz2akv

After base64-encoding the resulting string, add it to the Authorization header as follows:

Authorization: Basic amRvZUBleGFtcGxlLmNvbS90b2tlbjo2d2lJQldiR2tCTW8xbVJETXVWd2t3MUVQc05rZVVqOTVQSXoyYWt2
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