0
votes

I need lat, long of an address so i use : https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway, +Mountain+View,+CA&key=YOUR_API_KEY

with my API Key

I have made this request from service in angular client Response is : Access to XMLHttpRequest at....has been blocked by CORS policy: Request header field authorization is not allowed by Access-Control-Allow-Headers in preflight response.

1

1 Answers

0
votes

I think problem is that your request contains Authorization header. CORS error which you posted says:

Request header field authorization is not allowed by Access-Control-Allow-Headers in preflight response.

So the API does not allow Authorization header to be sent in your request. You should probably do authorization only by API key in query param, as you posted.

Additional details: Access-Control-Allow-Headers of a preflight response specify which headers are allowed in your CORS request. If your request contains headers, which are not specified there, you will get CORS error.