Google Maps API V3 error: RefererDeniedMapError

2020-02-12 13:15发布

Im facing a problem with Google Maps Javascript API V3. The console log shows:

Google Maps API error: RefererDeniedMapError https://developers.google.com/maps/documentation/javascript/error-messages#referer-denied-map-error

Google documentation about this error is damn poor and even when he says to check Developer Console searching for more details i can't manage to find any more details about that errors, it may be related to some of the info posted in the following list. I saw that in the Google Console you can somehow enable logging or other stuff but it needs Google SDK which atm i can't afford to configure since it would mean going out of budget

The question is already asked here: Javascript error in Google Maps API v3 (RefererDeniedMapError) but none of the answer could help me.

Here's what i've tried so far:

  1. Regenerating Google Api
  2. Enabling/disabling domain restriction in the Google Console
  3. Changed key from browser to server
  4. Trying to understand if the domain was for some reason banned by Google
  5. Creating new project on Google Console and generating a whole new Javascript API key without (from the beginning) domain restriction

Let me give some more background data:

  1. Im working for an external client on an already existent site, he knows nothing about pre-existing google accounts that may have an api key already configured (they were using some Google API services but thats all i know)
  2. I managed to discover they have been contacted by google about the API usage quota but again i don't know what the comunication details where about.
  3. They have an IIS server and im buiding the new site in a subdirectory of their main domain
  4. I've noticed that somehow a self-request (ajax) from the new website to self site results in an cross-domain request which is really weird in my opinion, too bad i don't know what their server configuration is in more details.
  5. I've checked the free plan for Google Api and the limit is 25K daily, the client said he shoudn't be able to go that high but he is willing to pay to re-enable the API's
  6. I've tested a newly generated API on local environment & other testing live domain and it looks like working, but as soon as i try those keys on the guilty domain the Error pops out

My question are:

  1. Is there a safe way to understand if the domain is somehow banned by google for API's overquota usage or some other reasons?
  2. How can i be sure that creating a billing account for the domain and allowing the API plan to go higher then 25k will enable my plan again?
  3. Is it a javascript-related problem? I think i've did all i could to check this part but i'm open to suggestions.
  4. Does it matter if there are multiple google accounts referencing the same domain for API usage? I mean that from what i know there may be multiple Google Accounts with different API keys created for the same goal in that domain (domain restriction or not they could be still being used)

2条回答
虎瘦雄心在
2楼-- · 2020-02-12 14:06

You can try the suggestion made in this issue.

"You could try to disable IP to domain name redirection (as you have now), and use your IP in the example above. It’s not a pure solution, but at least you can have a map on your website."

You can also check the answer here, if it can help you.

Then if any of the above solutions doesn't helps you, then I think you should consider the recommendation of MrUpsidown.

查看更多
Juvenile、少年°
3楼-- · 2020-02-12 14:12

For everyone who will ever land on this question in the future: turns out it was a domain problem. I managed to contact one from the google support service using their forum: https://code.google.com/p/gmaps-api-issues/

After posting my question there i've been told that the domain i was working on had a past with Google licensing, it had once a commercial plan activated and then someone from the past violated Google's ToS. Sadly there's no way a normal user can check if your domain has violated Google's ToS in the past so i had to wait an answer from the Google Support Team.

Long story short: if you have a domain banned by Google in the past you are in trouble and have 2 way out: - Change your domain to get a fresh one which is not banned - Pay 10,000$ for a Google Licence for work (not a premium one,just "basic" licence) if you want to work again with API. The price is not fantasy, that's what I've been told by google Support.

Hope this will help someone to figure out this poorly documented error.

UPDATE

The documentation has been updated and clear explanation was added:

RefererDeniedMapError Your application was blocked for non-compliance with the Google Maps APIs Terms of Service, following several email notifications. To appeal the block and have your implementation reviewed, please complete this form. You will receive a response via email within a few business days.

https://developers.google.com/maps/documentation/javascript/error-messages

So, everybody who faces this issue can submit an appeal form from now on.

查看更多
登录 后发表回答