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

249
Views
Can't pass authorization with AJAX request on JS

I'm trying to send a basic AJAX request through browser console. The task demands an authorization so I've got a login and a secret key for the request. My code:

var xhr = new XMLHttpRequest();
xhr.open('POST', 'https://api.mindbox.cloud/v3/operations/sync?endpointId=hh.ru&operation=get.user', true, 'login', 'secret key');
xhr.setRequestHeader('Content-type', 'application/json; charset=utf-8');
xhr.send();
console.log('status:', xhr.status, xhr.statusText);
console.log('xhr.response:', xhr.response);

the problem is that everytime I get the 401 error and a response from server:

Authorization header is incorrect. Correct header example:\r\nAuthorization: Mindbox secretKey=\"PUT_YOUR_SECRET_KEY_HERE\

Can anyone kindly help me here? I've tried hard to find some info about authorization headers but couldn't achieve anything valuable.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can set the header just like you did with Content-type

req.setRequestHeader('Authorization', 'Mindbox secretKey=\"PUT_YOUR_SECRET_KEY_HERE\"');
about 4 years ago · Juan Pablo Isaza 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!