Start a new topic
Answered

Node POST to /api/run.json - Authentication credentials were not provided.

Please can someone help, because the most basic of tasks has turned into a nightmare. I've tried several node libraries to simply POST to /api/run.json to trigger a crawl but I get the creds not provided response. 


Please could someone enlighten me how to how/if this is possible? It works fine from postman. Example code I used below:


 

const form = new FormData();

form.append('apiKey', "removed");

form.append('spider', "xxxx");

form.append('project', "12345");

 

fetch(this.SCRAPE_URL, { method: 'POST', body: form })

.then(res => res.json())

.then(json => console.log(json));


Many thanks


Best Answer

Apikey is not a data parameter. You should send authentication via Authorization header, or any basic auth method that Node libraries provide.


Answer

Apikey is not a data parameter. You should send authentication via Authorization header, or any basic auth method that Node libraries provide.


1 person likes this

Thanks nestor! i think postman will handle a parameter named apikey differently as it works with apikey in the body. How annoying! All working now...apikey can also be sent as a url parameter i discovered. 

That's right it can also work as a url parameter. I'm glad it is working now.

Login to post a comment