-
Notifications
You must be signed in to change notification settings - Fork 662
Description
I am having a problem with this.
I have been experimenting for 3 days, but I cannot upload the image uploaded by postman with javascript.
I used such a code.
`
var authHeader = oa.authHeader(
"https://openapi.etsy.com/v2/listings/"+listingId+"/images",
req.session.oauth.access_token,
req.session.oauth.access_token_secret,
);
console.log(authHeader);
var options = {
"method": "POST",
"url": "https://openapi.etsy.com/v2/listings/"+listingId+"/images",
"headers": {
"Authorization": authHeader,
},
formData: {
"image": {
"value": fs.createReadStream(path.join(__dirname, "images/"+image_path+".jpg")),
"options": {
"filename": path.join(__dirname, "images/"+image_path+".jpg"),
"contentType": null
}
}
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
`
I get this error.
OAuth oauth_consumer_key="cpuao0wzd2q3l152x30nzebp",oauth_nonce="R88aVNfFRhz17yA3nQYeX4ZE1PfG1Zhb",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1597230278",oauth_token="a02ee077a56d97527ade2ecd24423c",oauth_version="1.0A",oauth_ signature="iCBcTHEXb638wXabJPJ2RUQeeew%3D" oauth_problem=signature_invalid&debug_sbs=POST&https%3A%2F%2Fopenapi.etsy.com%2Fv2%2Flistings%2F839582160%2Fimages&oauth_consumer_key%3Dcpuao0wzd2q3l152x30nzebp%26oauth_nonce%3DR88aVNfFRhz17yA3nQYeX4ZE1PfG1Zhb%26oauth_signa ture_method%3DHMAC-SHA1%26oauth_timestamp%3D1597230278%26oauth_token%3Da02ee077a56d97527ade2ecd24423c%26oauth_version%3D1.0A