I can’t seem to find an example anywhere that covers signature authentication through the API. The NodeJS sdk requires authSecret so I can’t use it.
Every time I try to use the API endpoint directly, I get “INVALID_FORM_DATA”.
This is how I build my formdata. I’ve tried a couple different variations but they all are failing. The lack of examples for signature authentication is very frustrating considering it’s stated as a best practice
let form = new FormData();
form.append('file', fs.createReadStream('tests/files/Mountain_Dig_Site.png'));
form.append('params', response.params),
form.append('signature', response.signature)
let transloadit_response = await (await fetch('https://api2.transloadit.com/assemblies', {
method: 'post',
headers: {
'content-type':'multipart/form-data'
},
body: form
})).json()
console.log(transloadit_response);
Example of the Response Object (certain stuff replaced with ####)
{
params: '{"auth":{"key":"####","expires":"2021/03/17 01:45:53+00:00"},"steps":{":original":{"robot":"/upload/handle"},"filter":{"use":":original","robot":"/file/filter","accepts":[["${file.mime}","regex","image"]],"error_on_decline":true},"viruscheck":{"use":"filter","robot":"/file/virusscan","error_on_decline":true},"convert_image_webp":{"use":"viruscheck","robot":"/image/resize","format":"webp","imagemagick_stack":"v2.0.7"},"compress_image":{"use":"convert_image_webp","robot":"/image/optimize","progressive":true},"watermark":{"use":"compress_image","robot":"/image/resize","watermark_url":"https://demos.transloadit.com/inputs/transloadit-padded.png","watermark_size":"25%","watermark_position":"bottom-right","imagemagick_stack":"v2.0.7"},"resize_image":{"use":"watermark","robot":"/image/resize","resize_strategy":"fit","width":100,"height":100,"imagemagick_stack":"v2.0.7"},"export":{"use":["convert_image_webp","compress_image","watermark","resize_image"],"robot":"/backblaze/store","credentials":"####","path":"advl-test/${file.url_name}"}}}',
signature: '6318bb36d48106fad9086219bb4ce41e7d86eb85'
}