How to use the avatar without CORS problem Not planned

Post author
French Builders null

Hello !

I would like to use the avatar which is in the memberstack's user account, but when I try to use it in JS, I have CORS problem.

Do you have an idea to bypass this header problem ?

For more information, I'm trying to use html2canvas and jsPDF libraries on this.

 

Thanks a lot,

 

Koty

Comments

2 comments

  • Comment author
    Duncan Hamra

    Josh Lopez Do you have any tips for this one? I'm not quite sure myself 🤔

    0
  • Comment author
    French Builders null

    Ahaha ! Sorry for this one ! I'm in test mode, does it matter ? I just use the html2canvas function. When I use the 'CORS Enable' extension for chrome it works just fine ! 

    I work with the google cloud function and I had the exact same issue, I just add this : 

    res.set('Access-Control-Allow-Origin', 'https://fairemoncv.webflow.io');

        if (req.method === 'OPTIONS') {
                // Send response to OPTIONS requests
                res.set('Access-Control-Allow-Methods', 'GET');
                res.set('Access-Control-Allow-Headers', 'Content-Type');
                res.set('Access-Control-Max-Age', '3600');
                res.status(204).send('');
        }
    And it works juste fine, or we can add the * in the Access-Control-Allow-Origin
    0

Please sign in to leave a comment.