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

≯℡__Kan透↙ 提交于 2019-11-28 01:31:45

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!