I have a problem with my Google Maps API key. I get an alert saying "This web site needs a different Google Maps API key." When I prees OK to the alert the map are loading and working fine.
The same problem is already posted:
Google Maps API key not working
I have tried to request the API key for both "http://www.domain.com" and "http://domain.com" but I still get the alert.
When I follow the instructions from their FQA and use alert(window.location.host) I get www.domain.com but the api key generator will only accept the domain if the prefix is http://
Does anyone have a solution to this?
I found out that is was a generel encoding error in my google maps api script tag. I got the alert error when I had a script tag like this:
<script src="http://maps.google.com/maps?file=api&v=2&key=MyGoogleMapsApiKey" type="text/javascript"></script>
The problem here is the duplicated amp;wich was generated from a scriptmanager in asp.net. So the & was replaced with &.
The script tag should look like this:
<script src="http://maps.google.com/maps?file=api&v=2&key=MyGoogleMapsApiKey" type="text/javascript"></script>
So if you are using a scriptmanager to add script tags or in any other way dynamically adding script tags to your pages, wach out for duplicated amp;.
You have to sign up for the new google API key for your new domain, I used to get the same error message, because I use the old API with the new domain, please click the following link to register your new API key for the new domain.
http://code.google.com/apis/maps/signup.html
Hope this can help.
Vutha
I had the same problem. I remembered that Google calls my Appspot app by a different name found in the Versions area of the App Engine Dashboard. I changed the name of the URL to the long version and the key started to work... e.g. LIVE URI... http://5.latest.myappname.appspot.com.
You'd think they could resolve their keys to their own app hosting service urls.
Regards,
John
Related
I have built a custom google map using their Maps JavaScript API and Places API. It's worked fine for several months but now when I try to access the map, I get the "Oops something went wrong" error and receive the following message in Chrome's Console.
https://developers.google.com/maps/documentation/javascript/error-messages#invalid-key-map-error
When I click on that link it tells me that "The API key included in the script element that loads the API is not found." I log into my Google Maps Dashboard and the API key is still there.
Do these expire? Do I need to periodically create new keys?
I found the problem. It had nothing to do with either my API key or my billing account. The problem was due to where I had the &libraries=places parameter in my <script... statement.
This fails:
<script async defer src="https://maps.googleapis.com/maps/api/js?libraries=places&key=MY KEY IS HERE&callback=initMap"> </script>
This works:
<script async defer src="https://maps.googleapis.com/maps/api/js?key=MY KEY IS HERE&libraries=places&callback=initMap" async></script>
If I place the libraries=places parameter after the API key parameter, it works fine. But if it's placed before the API key parameter, it fails with the "The API key included in the script element that loads the API is not found." error.
I can see that I had originally malformed the <script... statement, but it used to work that way, with the libraries=places parameter before the API key parameter - ran for months, no problems - but a few days ago it started throwing this error.
I thank both of you for taking the time to answer me.
I have one question, as mentioned
here I'm doing a jQuery/Javascript only homepage.
Now I'm trying to get the pictures from a google drive with the google drive API. The authentication with 0Auth worked very well.
But I'm not sure if it's the right way, because the authentication confused me a little bit.
Here in Step 2 I have to use my Client ID and login with my user, does this mean the Website is now verified to use the API or does this mean everybody who wants to see the pictures has to login?
What happens if the key is not valid anymore or how often do i have to renew it?
Thanks for your help
Before you can integrate Google Sign-In into your website, you must have a Google API Console project. In the project, you create a client ID, which you need to call the sign-in API.
AFAIK, client ID doesn't expire, only access tokens which expire after 60 minutes. If you have a refresh token you can use the refresh token to get a new (valid) access token.
Here's some references which might help:
Google Drive API using Javascript
How to use Google Drive API to download files with Javascript
I have got the crypto key and client id from google to sign my website.
The google documentation says we should sign using server side generating the url using hash algorithm.
https://developers.google.com/maps/documentation/directions/get-api-key?utm_campaign=eps&utm_source=unify#sample-code-for-url-signing
But I have my map built in client side code using gmap with a reference to the script library.
.." src="http://maps.google.com/maps/api/js?sensor=false">...
Can I include the crypto key directly in this tag as
.script type="text/javascript" src="http://maps.google.com/maps/api/js?key=CRYPTO-KEY&sensor=false">..
Will this work fine or should I modify the code to get the urls server signed and build the map?
Help/Advice requested. Thanks.
You must not include crypto key in the <script> tag of Maps JavaScript API. You have to use the client parameter instead of key and additionally authorize the URL of your page in your support portal.
Your script tag should be like
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?client=CLIENT-ID&v=3></script>
Have a look at the documentation
https://developers.google.com/maps/premium/previous-licenses/clientside/auth
Please note that crypto key is used to generate digital signatures of Web Service requests.
I have a cross-platform app with cordova , but now the google map is not working.
I have this error :
MissingKeyMapError
I try to create new api browser key in google console with "*" authorization url , but still not working. i have this error : RefererNotAllowedMapError
the window.location.href of my app is :file:///Users/bahri/Library/Developer/CoreSimulator/Devices/757EE924-9884-44B1-B‌​BF5-04CFF3D68C80/data/Containers/Bundle/Application/820BF808-DFF7-4AB0-8BF8-179D2‌​78E90D5/com.taxiwink.taxiwinkapp.app/www/index.html
How can I resolve this issue?
As per today (15 Jul 2020) the following http referrers allows to show a Google map in a cordova app:
iOS:
__file_url__//var/containers/Bundle/Application/*
__file_url__//private/var/containers/Bundle/Application/*
(credit to yannisalexiou for having added the last one which works from iOS13)
Android:
__file_url__//android_asset/www/index.html#/*
__file_url__//android_asset/www/index.html
cordova simulate (eg: simulate ios --target=chrome)
127.0.0.1
localhost
the referrers go into the Google Console API management (API-Project, credentials, referres) at:
https://console.cloud.google.com/apis/credentials/key/abcxyz?project=api-project-123456
NOTE: developed from the answers here https://github.com/wevote/WeVoteCordova/issues/55
MissingKeyMapError Error
The script element that loads the API is missing the required authentication parameter. If you are using the standard Maps JavaScript API, you must use a key parameter with a valid API key. If you are a Premium Plan customer, you must use either a client parameter with your client ID or a key parameter with a valid API key.
See the guide to API keys and client IDs.
From :
https://developers.google.com/maps/documentation/javascript/error-messages#deverrorcodes
https://developers.google.com/maps/documentation/javascript/get-api-key
Also:
Registering authorized URLs
To prevent a third party from using your client ID on their own website, the use of your client ID is restricted to a list of URLs that you specifically authorize.
To see the URLs you have already authorized or to authorize additional URLs:
Log in to the Google for Work Support Portal.
In the left-hand menu, click Maps: Manage Client ID.
You can add up to 100 URLs at a time, to a total of 3000 URLs. If you require higher limits, please contact support.
HTTP and HTTPS protocols are considered different URLs.
For example, if https://example.com is authorized, http://example.com is not necessarily authorized. If you'd like to authorize both at once, you may add a domain without using a protocol: example.com/
You should empty the list of authorized HTTP Referers for your key, in the API Console. This should make the map succeed (after a 5-min propagation delay).
Related issues (it's suggested to "star" them to get an update on their resolution):
Support API key restrictions with file:// referers
Google Maps
API error: MissingKeyMapError when loading from file://
UPDATE
Good news, now you can use file:/ referrers. You can see the following text in the documentation
file:// referers need a special representation to be added to the Key restriction. The "file:/" part should be replaced with "__file_url__" before being added to the Key restriction. For example, "file://path/to/" should be formatted as "__file_url__/path/to/*". After enabling file:// referers, it is recommended you regularly check your usage, to make sure it matches your expectations
https://developers.google.com/maps/documentation/javascript/get-api-key#key-restrictions
I have a website I developed for a client. One of the pages displays a list of street addresses, for which I also have LAT/LONG data. The client requested to add a little map next to this list with a marker for each address.
I would like to use Google Maps API v3, but I have a problem registering client's internet facing URL, which has a form of "ip address:port" (i.e. something like http://123.45.67.89:555) and which I - naturally - do not own and do not have domain admin access. Likewise, their domain admin - whoever s/he is - does not and will not have access to my Google API project for which I'm trying to register the key.
So far I was able to register the client id for local development in a form of http://localhost:5555, but when I'm trying to add the client's URL I'm getting an error
OAuth 2 redirect URL "http://123.45.67.89:555" is invalid.
I searched for solution for this problem and found a suggestion to whitelist the URL in the Google API Console. Yet when I'm trying to add this URL to approved domain list ("notification endpoints") I'm only getting another error:
You do not have access to the following domain:
http://123.45.67.89:555
which is, of course, true. The documentation also says I cannot register a domain I don't own.
So, my question is: how do I register a Client ID for Google Maps API V3 for the client's URL to which I don't have domain admin privileges and whose domain admin doesn't have access to my API project?
Thank you!
Nikolai
You can create a view of the table (File | Create View ...) and own the view (https://support.google.com/fusiontables/answer/171206?hl=en) - thus enabling you to have your own version of the table which is in sync with changes.
As a footnote remember to deal with Cross Origin Resource Sharing (CORS) in your API project by using JSONP for example (https://developers.google.com/storage/docs/cross-origin).
If your are using Google Maps API v3, there is no need to use Google API Key. Simply use below script.
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>