auto extraction using Nodejs ist showing Authentication token not provided or invalid

Posted about 2 years ago by Sarath CM

Post a topic
Un Answered
S
Sarath CM

 

const https = require('https');


const data = JSON.stringify([{

'url': 'http://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html',

'pageType': 'product',

}]);

const options = {

host: 'autoextract.scrapinghub.com',

path: '/v1/extract',

headers: {

'Authorization': 'Basic ' + Buffer.from('api_key_from_created_account').toString('base64'),

'Content-Type': 'application/json',

'Content-Length': data.length

},

method: 'POST',

};

const req = https.request(options, res => {

console.log(`statusCode: ${res.statusCode}`)

res.on('data', d => {

process.stdout.write(d)

})

});

req.on('error', error => {

console.error(error)

});

req.write(data);

req.end();

The same sample code is used but shows "Authentication token not provided or invalid". Using API key from Settings-> API key

1 Votes


1 Comments

S

Sandra Menon posted over 1 year ago

Faced the same issue

0 Votes

Login to post a comment