After months of 100% stability, today I get 403 Error on google maps services

后端 未结 2 1498
别那么骄傲
别那么骄傲 2020-12-06 21:46

I was just wondering if someone could shed some light on why I am seeing 403 Forbidden errors for my google maps services.

I had been loading the maps api as such:

相关标签:
2条回答
  • 2020-12-06 21:59

    The Google Maps JavaScript API recently advanced a minor version increment to 3.9changelog and the default version advanced from 3.6 to 3.7. I notice that you aren't specifying a version in the URL you use to load the Google Maps JavaScript API library, so you retrieve the default version, 3.7. One important thing about version 3.7 is that it now requires the use of keys for some libraries. Info about which version you should use is available in the Versioning section of the Developer's Guide.

    A few others have run into similar problems, but if you are running fine after adding the key, you should be good. If you would like to receive notifications about Google Maps API changes in the future, you may register for notifications.

    0 讨论(0)
  • 2020-12-06 22:10

    This problem just re-emerged even with an API key set - and I think the issue actually lies with caching the google maps javascript.

    I have my web server dynamically decide what javascript to combine, minify and cache locally. This is done using RequestReduce.

    When the client-side javascript becomes stale (roughly 3 days in my case) - google returns 403 unauthorized.

    The API key was just a red herring. I can remove the key and my code still works - as long as the maps js is "fresh".

    In my case, the fix was to add maps.googleapis.com to the RequestReduce ignore list:

    javascriptUrlsToIgnore="maps.googleapis.com"
    

    For others, just make sure to not cache the maps.googleapis.com javascript for more than a few hours, if at all.

    0 讨论(0)
提交回复
热议问题