My google map works on local host perfect, but when i get key from codes.google for my server ip my google map alerts your browser does not support google map
i dont know what is my problem can anybody help me?
Try to get a the key for the full domain name (including subdomain), not the IP address.
You can't use your ip address to get an API key.
Also, you don't need to use your full domain name. If you get an API key for 'example.com' - all of the sub-domains and directories on example.com will also be valid.
The problem is not solved yet but i think that it is important to say that when download java script from google from address
http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAmfxEy26bISZt8fzqRClItBRc5N-P1NpY03Egq3jSesNMkYFHpRQxlBgZQE1fKa5udtRsjyL77M61mw
GValidateKey("") is in java script but i find in the web that it contains a key
Related
I have a worker (servlet) called by a queue in google app engine.
I can call an external URI for reverse geocoding like: http://nominatim.openstreetmap.org/reverse?format=xml&lat=51.0475&lon=3.5323&zoom=18&addressdetails=1
But when I try to call the "The Google Geocoding API" with/without the key parameter: http://maps.google.com/maps/api/geocode/json?latlng=51.0475,3.5323&sensor=false, I always get the following message: Attempt to access a blocked recipient without permission. (mapped-IPv4)
The billing is active, the key is also defined in the dev console, and the URL with the key work in my browser but not from app engine.
Any ideas? Thanks
to avoid the issue, i don't use anymore the org.apache.http.client package but now i use the com.google.appengine.api.urlfetch package.
Now the URI to google also work
thanks
I'm developing my application using Laravel Homestead virtual server. Of course I've rewrite my site from http://192.168.0... to http://myaplication.app. Then I need to create a Google Api key to implement Google maps on my project but I can not generate my api key.
This is how I am doing that:
But Google throws me an error telling me the application is not authorized. Can someone help me?
This is because Google need a regular domain like app.com for "URIS de redireccionamiento". Google doesn't allow local Ip's (e.g. 192.168...).
The solution is simple, because you are in development you have to add http://localhost in Javacript origins and leave blank other form fields where Google asks for ips or URls.
I want to use the places api for getting the places names within a circle in localhost. Does anyone know how to get the client id for localhost?
I'm using Visual Studio and when I debug locally the URL is:
http://localhost:2386/index.html
To connect to Google API I set the following two properties of the Client Id in the API Access tab of the Google API console:
Redirect URIs: http://localhost:2386/oauth2callback
JavaScript origins: http://localhost:2386
I'm using the Analytics API but hopefully this will help in your case as well.
I am not sure if this is what you are looking for but a possible workaround could be:
Get to know the IP of your computer (e.g.: http://whatismyipaddress.com/)
Add your IP in this Format (http://xx.xx.xxx.xx/) to the Google Console (https://developers.google.com/console/)
Use the API-Key for testing.
Be sure that your IP doesn't change :)
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
I have obtained a Google Maps API key for my domain.
The examples provided when I obtained my key show the key embedded in request parameters, for example:
<script src="http://maps.google.com/maps?file=api&v=2&sensor=true_or_false&key=my-key" type="text/javascript"></script>
I appreciate that the referrer field in requests must match my domain, is it safe to make my key visible in script tags and the like? Or are there any other steps I should take?
Considering that key has to be included in the <script> tags of your HTML pages, to load the JS files/data from google's servers, there is nothing you can do :
you must put it in your HTML files
every one can take a look at those.
Still, it doesn't really matter : if anyone tries to use this key on another domain than yours, they will get a Javascript alert -- which is not nice for ther users.
So :
There is nothing you can do ; this is the way it works
And there is not much you should worry about, I'd say.
There is setting on Google API console that can protect your API bandwith usage from being used by another domain/user. You can restrict and protect that by using referrer on the API console. API Key will reject requests without referrers that match your restrictions.
Here is screenshot from Google for API Key that can only be used by Google frowm its two domains.
Though this question is a few years old it's a very good one. As I understand it exposing API keys, even if they are domain matched, could still lead to abuse. There's a post on Security Stack Exchange here that covers this in more detail.
The steps that you can take to avoid potential abuse have been published by Google here:
Best Practice Guide for securely using APIs:
https://support.google.com/cloud/answer/6310037?hl=en
Though I would recommend taking all of it on board, there is an approach that would deal with the specific example that was posted by Brabster and that's to store the key in an environment variable. This way all you need to do is to substitute the key for a server-side variable that is stored within your project. However, be sure not to commit the file that stores the key to a public repository.
You should use back end/server side to protect and handle key. In my case I used Django f/w server side which can serve a ajax call to get the key from server script/db then pass it onto google api.