The Google Street View API API returns 403 for API keys with outbound domain restriction

I signed up for the Google Street View Image API. I can capture images using the API with my API key when I copy the URL to the browser location bar. But when I try to programmatically upload the image via jQuery, I get the 403 http code. For example, if I use something like:

$('#imgdiv').css('background-image','url("[streetview url with API key]");

Then the image does not load, and the Javascript console says:

GET [streetview url with API key] 403 (OK)

As far as I can tell, this is apparently not a speed limit problem. I probably only requested 1-200 images. And I can print the same URL in my browser and it appears. The domain with the code loading these images is verified.

UPDATE:

I tried using the API key without domain restrictions, and this works fine. So it seems like my problem is determining the source domain. When generating the key I used *.mydomain.com/*, but it does not work. My domain does not have a previous one www(for example, only mydomain.com). Could this be a problem?

Ideas?

+4
source share

Source: https://habr.com/ru/post/1612187/


All Articles