Fetch call error due to CORS Policy

I am basically trying to update a collection in Adalo from my frontend application coded in ReactJS. I am using the following code to achieve the same -

                   const saveToAdaloPayload = {
                        "Description": "Project description",
                    };

                    const saveToAdaloResponse = fetch('https://api.adalo.com/v0/apps/<appId>/collections/<collectionId>', {
                        headers: {
                            'Content-Type': 'application/json',
                            'Authorization': 'Bearer <secret API key>',
                        },
                        method: 'POST',
                        body: saveToAdaloPayload,
                    })
                    .then((result) => {
                        if (result.ok) {
                            return result;
                        }
                    }).catch((err) => {
                        console.log(err);
                    });

I get the following error -
Access to fetch at 'https://api.adalo.com/v0/apps/<appId>/collections/<collectionId>' from origin 'http://localhost:3000' has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.

If I try to set the request’s mode to ‘no-cors’, then I get a 401 ‘unauthorised error’. Please guide me on this.

@B0untiful_26 @Erik any solutions for this issue?

Hey, maybe @Erik better in this I don’t currently understand why it says that but if Erik says it’s a bug then message the adalo support!

Not familiar w/ this, sorry. I’d ask the Adalo team. It isn’t a bug, but most likely some issue with the token or auth.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.