tsayen / dom-to-image

Generates an image from a DOM node using HTML5 canvas
Other
10.41k stars 1.69k forks source link

Cookies not passed to image request #464

Open HassanRaza1112 opened 1 year ago

HassanRaza1112 commented 1 year ago

I am using secure image in <img src="https://mydomain.com/secure/images/> dom-to-image.toJpeg()

These images can only be fetched if image request have my cookies from browser local storage. dom-tom-image during conversion when request those image doesn't send browser cookies.

    const dataUrl = await domtoimage.toJpeg(imageRef.current, {
                    quality: 0.95,
                    cacheBust: true
                });
                let link = document.createElement('a');
                link.download = `screenshot.jpeg`;
                link.href = dataUrl;
                link.click();

Expected behavior: Send browser cookies along with the img request inside dom-to-image. Actual behavior : Gives 403 forbidden even cookies are saved with same domain name. Library version: 2.6.0

negative-cookies1

positive-cookies1