Learn all about the latest trends and best practices in data extraction - Join us at Extract SummitGet tickets
Start a new topic

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

 

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

Login to post a comment