I have my OAuth login and callback methods in my API for Facebook,Google,Twitter. It is an expresss app running on port 3000.
I have another angular 2 application running on port 4200. I am trying to call the express api url through http get. It is throwing me the CORS error.
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. cross-Origin Read Blocking (CORB) blocked cross-origin response with mime type text/html
CORS exists to protect your server from unwanted external AJAX requests. You need to actively enabled CORS on your server in order to use it.
Since you didn't specify your server type, here's how to do it on IIS and here's how to do it on Apache. If you use a different type of server, you should look for 'Enable CORS' on that specific server type.
The best practice would be to ONLY allow CORS for the domains you want to open up to, and not allow everything (*), since this would increase the potential vulnerability of your server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With