CORS Blocking Firebase Connection

I’m trying to build a simple sign-up page so users can create an account and register it through Firebase Authentication. Despite adding a Access-Control-Allow-Origin header, I still get the following error: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Hey,

The error messaging is quite misleading at times, it might be some other issues than CORS. If you check your developer tools (right-click on your browser → Inspect → open the Network tab) and then test your request, can you see any error with your request?

I ended up using HTTP requests in the logic flow instead which did the trick without any CORS issues. It seems like setting up through the Data tab was causing the problem, but I couldn’t pinpoint what it was

You can set CORS permissions in Cloud Functions by setting HTTP Headers inside of specific Functions.

Do you have an example how you ended up settings CORS permissions in Google cloud functions? I’m using cloudflare workers andI have a similar problem there.

This is how I’ve set it up with Google Cloud Functions, on a per Function basis:

exports.thisIsAFunction = functions.https.onRequest((request, response) => { response.set("Access-Control-Allow-Origin", "*"); response.set("Access-Control-Allow-Methods", "GET"); // Function continues });

If you use a different platform, the surrounding syntax will probably be slightly different, but the Access-Control information is the basic web standard, so that’s a quick copy-paste.