shanebp
shanebp

Reputation: 1956

Google Maps API RefererNotAllowedError

I have created an Google key for use with the Google Maps JavaScript API.

Every thing works until I add to the credential under Accept requests from these HTTP referrers

I added the referrer in this format: *.example.com/* Per the placeholder on the Credentials page.

Then the API stops working and throws this error in the js console:

Google Maps API error: RefererNotAllowedMapError 

https://developers.google.com/maps/documentation/javascript/error-messages#referer-not-allowed-map-error
Your site URL to be authorized: http://example.com/test/

The call in the scripts tag on the site:

http://maps.googleapis.com/maps/api/js?key=***********

So it seems to be telling me I need to specify the exact url in the referer list.

But I thought the purpose of using the * wildcard was so the whole site would allow usage.

Is it really necessary to specify every single location on your website that will use the Map API ?

Upvotes: 1

Views: 863

Answers (1)

geocodezip
geocodezip

Reputation: 161334

*.example.com/* (all sub-domains of example.com) doesn't match example.com/test/ (it would match www.example.com though).

You need to authorize example.com/*

Upvotes: 2

Related Questions