401 (Unauthorized) İssue

image
image

I wrote a simple JavaScript code… The code simply finds the element with the ID attribute “savedElement1” and converts it to PNG. At the end of the process, I expect the generated file to be sent to the value of the “JavascripttoBubble A” element. However, no matter how much I try, I keep getting a 401 (Unauthorized) error. What steps should I take to authorize the JavaScript code?

JS:

function captureElementAsImage() {
var element = document.querySelector(‘[attribute_id=“savedElement1”]’);
if (element) {
html2canvas(element).then(function(canvas) {
var imageData = canvas.toDataURL(‘image/png’);
bubble_fn_getimage(imageData);
}).catch(function(error) {
console.error(‘Error capturing the element:’, error);
});
} else {
console.error(‘Element with attribute ID “savedElement1” not found.’);
}
}

captureElementAsImage();

its a bit tricky, i did it with QR code, i generated with code as a SVG, and then pass that svg into bubble api as base64 then from backend i saved it in DB