Hi
I want to implement the following CURL command in a simple HTTP node-red node. How can I do that?
curl -k -d "grant_type=client_credentials" -H "Authorization: Basic Zlp2NXJYRZ4T3dQc1dkM0lzREhhWEdzYTpLZHlTbmFiZl8wQldqR3ozQjYxREcxQ01lUW9p, Content-Type: application/x-www-form-urlencoded" https://eco-counter-tools.com/token
I created a Function node like as follows and then connected with HTTP-Request node:
var key ="key string";
var secret = "secret string";
var concatenated = key+":"+secret;
var hash = (new Buffer(concatenated)).toString('base64');
msg.method ='POST';
msg.url = "https://eco-counter-tools.com/token";
msg.headers = {};
msg.headers['Authorization'] = 'Basic '+hash;
msg.headers['Content-Type'] = 'application/x-www-form-urlencoded';
msg.payload = "grant_type=client_credentials";
return msg;
But I got 403 error (No matching resource found in the API for the given request). What did I do wrong?