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

270
Views
{ error: 'invalid_client' } al usar la API de Spotify

El error da 'cliente no válido' y Solicitud incorrecta. Encabezados cotejados, no se puede encontrar la causa del error. Encontré esto mientras implementaba el flujo de código de autorización de Spotify.

El encabezado de esta publicación debe contener Autorización como parámetro.

Cadena codificada en Base 64 que contiene el ID del cliente y la clave secreta del cliente. El campo debe tener el formato: Autorización: <base64 encoded client_id:client_secret>

 app.get('/callback', (req, res) => { const code = req.query.code || null; const state = req.query.state || null; const storedState = req.cookies ? req.cookies[stateKey] : null; axios({ method: 'post', url: 'https://accounts.spotify.com/api/token', data: queryString.stringify({ grant_type: 'authorization_code', code: code, redirect_uri: REDIRECT_URI }), headers: { 'content-type': 'application/x-www-form-urlencoded', Authorization: `Basic ${new Buffer.from(`${CLIENT_ID}:${CLIENT_SECRET}`.toString('base64'))}` }, json: true }) .then(response => { if (response.status === 200) { const { access_token, token_type } = response.data; console.log(response.data) axios.get('https://api.spotify.com/v1/me', { headers: { Authorization: `${token_type} ${access_token}` } }) .then(response => { res.send(`<pre>${JSON.stringify(response.data, null, 2)}</pre>`); }) .catch(error => { res.send(error) }) } else { res.send(response) } }) .catch(error => { // res.send(err) if (error.response) { console.log(error.response.data) res.send(error) } });

})

about 4 years ago · Juan Pablo Isaza
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!