This is my full code...
this.http.post(link, data, { headers: headers })
.map(res => res.json())
.subscribe(data => {
this.data.response = data._body;
}, error => {
console.log("Oooops!");
});
after running the code this error is present:
"XMLHttpRequest cannot load
https://script.google.com/macros/s/AKfycbzdHHKBmLWJYZtFGlJGOrUwlPIWXor1geEOgcSgvhs/dev.
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:8100' is therefore not allowed access.
The response had HTTP status code 401."
I've searched about CORS... but I can't get my head around it...
Any help will be appreciated.
i have same issue but after some hours to search my problem gone.
ionic.config.json
you should use
ionic g provider [name-of-provider] --ts
it will generate provider to make a request like this:just remember:
/mobile/api/authentication
->/mobile
frompath
inionic.config.json
.Download the Allow-Control-Allow-Origin application from google chrome. Enable the CORS in the application installed and execute your code. This will temporarily allow the CORS in your browser.