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

211
Views
¿Cómo se envían datos desde un servidor local a la extensión de Chrome background.js?

Tengo dificultades para enviar datos desde mi servidor a background.js, pasar de background.js a mi servidor funciona perfectamente; sin embargo, cuando hago response.send(), cualquier valor que se ingresa allí no se muestra en la respuesta.

esto esta en mi servidor

 app.post('/login', (request, response) => { const creds = JSON.stringify(request.headers.auth) const credsclean = creds.substring(1) const credsclean2 = credsclean.slice(0,-1) const credsarray = credsclean2.split(':') const cred1 = credsarray[0] const cred2 = credsarray[1] getuser(cred1).then(res => { let resobj = res.pop() let respass = resobj.password const decipher = cryptoJS.AES.decrypt(respass, key); const decipher2 = decipher.toString(cryptoJS.enc.Utf8); if (cred2 === decipher2 ) { response.status(200).send({message: `${respass}`}) } else { response.status(404).send() } }) })

Esto está en mi background.js

 chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { if (request.message === 'login') { const user1 = request.payload.email const user2 = request.payload.password fetch('http://localhost:3000/login/', { method: 'POST', headers: { "Content-Type": "application/json", 'Auth': `${user1}:${user2}` } }) .then(response => { if (response.status == '200') { console.log(response) sendResponse('success') } else if (response.status == '404') { sendResponse('fail') } }) .catch() return true } });

Cualquier ayuda sería apreciada

¡Muchas gracias!

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!