I try to request the Google Timezone API from an AngularJS app.
But when I'm making my request I got this error in the preflight request :
XMLHttpRequest cannot load https://maps.googleapis.com/maps/api/timezone/json?location=48.8709,2.3561×tamp=14912286400&key=MY_KEY. Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response.
Here is my Google API configuration :
I've tried to disable preflight request by setting header with Content-Type: 'text/plain'
, but there is always a preflight request.
Do you think the error mentioned above is caused by the preflight request or do you think I should look in another direction ?
Thanks in advance
EDIT : I know how to enable CORS on my server, this is not the point. What I want is to access Google API from my AngularJS app without creating à WS on my server (if it's possible). If I don't have choice I'll do it, but in this case I know how to do it.
ANSWER : Thanks to @Sebas I solved my problem with the window.fetch()
API. This doesn't work on IE, but there is a great polyfill here : https://github.com/github/fetch.
I don't know if it's the best option to deal with my problem, but it works.