I am using Cordova to wrap my apps. As it can be, the app is running on the user's localhosts browser:
http://localhost:8100/
And I want to fetch data from the GCP but I receive an error of CORS (not ofcourse, ofcourse ;) (replace api_key with my real api_key):
Failed to load https://maps.googleapis.com/maps/api/directions/json?origin=Tel+Aviv&destination=Shoham&key=my_api_key: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access.
Now the reason is obvious: they do not want to make the API data public and sneaky by thefts, but I do not find any way to set my app as approvable for fetching this data.
My app runs on Android and on iOS.
I have also tried, just for the test, to disable any limitations or restrictions via the GCP platform manager but still data is not getting delivered.
**
When I am trying to fetch the data via Node.js API (*backend), the data is available to come, but its making things more complicated and slow since you have to make two calls for the same data.
Is there any fix for this?