Google Maps API DeletedApiProjectMapError - javascript

I have the exact same problem like Arul.
I am trying to use Google Maps API on my webpage but when I try to implement the map I've got DeletedApiProjectMapError.
First I went to the Error Messages site after I've tried many ways to include the script, like:
<script src="http://maps.googleapis.com/maps/api/js?v=3&key=API_KEY"></script>
//or
<script src="http://maps.googleapis.com/maps/api/js?key=API_KEY"></script>
//or
<script src="http://maps.googleapis.com/maps/api/js"></script>
and tried to add new API key on the Dev site but none of them works.
Is it possible that the error isn't on my side but on Google's?

I have found the solution to the problem.
You need to enable both the Google Maps Javascript API, and the Geocoding API.
https://console.developers.google.com/projectselector/apis/library
and
https://console.developers.google.com/google/maps-apis/apis/geocoding-backend.googleapis.com
Afterwards the error was RefererNotAllowedMapError instead of DeletedApiProjectMapError, but that was because I was running it on localhost - and it worked on the actual site after I added the domain in Credentials -> Domain Verification.

Just to add to the reply above with an image (and this solution worked for me while still staying on the local machine), because I was a bit confused about the enabling of APIs part.
Just navigate to:
https://console.developers.google.com/projectselector/apis/library
Select your project (for which you have an API)
On the right side expand the Maps API section and click on "Google Maps Javascript API" and the "Geocoding API"
On the page that appears you need to click on the "play" button to enable the API
Then you should be good to go without authorizing domains and continue working on the local machine.

Related

Google one tap login noCredentialsAvailable [duplicate]

I assume it has something to do with this:
For me Google one Tap stopped working on all my sites that previously worked. I added API HTTP refer to restriction in console.developer.com, but I still get a warning message "The client origin is not permitted to use this API." any thoughts? If you go to the page https://www.wego.com/ you can see that Google one tap still works...
https://news.ycombinator.com/item?id=17044518#17045809
but Google YOLO stop working for everyone. I use it like many people for login and it just stop work.
My domain are obviously added on console.developers.google.com
Any ETA for fix this? Some information would be great for people who rely on it.
Google YOLO is not disabled. It is open to a small list of Google Partners.
The reason you were able to access it earlier was because it was open for a short period of time but the whitelist is now readded/enabled.
Reference:
https://twitter.com/sirdarckcat/status/994867137704587264
Google YOLO was put on whitelist after a client-side exploit became clear to google.
People could cover the login button of the prompt with something like a cookie consent (which we all know people automatically accept).
Therefor people could easily steal their gmail or other details due to this google decided to put it on whitelist and review the sites that are using this technology in order to ensure that they are using it as they should.
Google retroactively labeled One-Tap as a "closed beta".
https://developers.google.com/identity/one-tap/web
The beta test program for this API is currently closed. We are improving the API's cross-browser functionality and will provide updates here in the coming months.
The link for the entire project is currently 404, but the beta statement is visible on the wayback machine.

Google Maps API error: DeletedApiProjectMapError

I have to use google map. I use below google API script
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=MY_API_KEY"></script>
And i got below Error
Google Maps API error: DeletedApiProjectMapError https://developers.google.com/maps/documentation/javascript/error-messages#deleted-api-project-map-error
I created a New Project & New API key. But still this error came. Kindly help to solve this error.
Yo should go to https://console.developers.google.com and after create your API KEY, go to "Google Maps JavaScript API" and just ENABLE (by default is DISABLE)
You need to enable Maps JavaScript API for your website.
API link: https://console.developers.google.com/apis/library/maps-backend.googleapis.com?q=map
Based from this documentation, the DeletedApiProjectMapError means that your API project may have been deleted from the Google API Console. Please check the project for which you generated the API key that's included in JavaScript API loader.
Since you have already created a new API project and get a new key on the Google API Console, one workaround I found on this forum is to try deactivating all plugins to see if one of them is causing a conflict.
Check this related link. It states that:
I created new API keys in the first project for those maps again and deleted second project. The maps work partially now - without markers. It looks a little like manual blocking by someone on the Google maps side. Maybe someone is blocking access to Marker Manager .js file somewhere between my computer and a server where it is stored to ban my website.
Hope this helps!
I activate/enable more API Google Maps on https://console.developers.google.com and disappear this error.
You have deleted the project in google cloud platform of which you created an API.Regenrate Api by creating a new Project in google cloud platform.
There some answers saying the JavaScript API needs to be enabled as it is disabled by default. That seems to have changed. It was enabled by default in my account. It did not work anyway. I had to disable and reenable the API, then it worked.
Also it is to be noted that Google says it may take a couple of minutes upon creation until the API key works, that may also have been the thing.

google not recognizing my api key

I have created a google developers account. I have created a project in there. I have enabled the JavaScript maps API for the project, and I have created a browser key for it, and I have limited the usage of it to the domain of my web site that people will be viewing. When I go to do an autocomplete call on a form field in my page, I get the following error back in the response.
"This service requires an API key. For more information on authentication and Google Maps JavaScript API services please see: https://developers.google.com/maps/documentation/javascript/get-api-key"
So I read the page, and that's how and why I set everything up previously mentioned. But it still will not work, and I just can't figure out why.
What subtlety am I missing?
BTW, this is with Chrome if that means anything, haven't bothered with other browsers
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=places&region=us" key="xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx"></script>
You're setting an HTML attribute. The key should instead be included in the src URL according to the link you posted.
Straight from their example:
<script async defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"
type="text/javascript"></script>
Notice the location of "YOUR_API_KEY" in the URL. Your best bet when dealing with APIs like this is to look for examples and follow them as closely as you can, trying to understand them. Then modify them to suit your needs.

Google api key not working [duplicate]

I am developing in JavaScript/HTML/CSS an app that uses Google Maps. I am getting the following alert dialog box:
"This page was unable to display a Google Maps element. The provided Google API key is invalid or this site is not authorized to use it. Error Code: InvalidKeyOrUnauthorizedURLMapError"
The app does actually display the map element; the alert is not a problem except it should not appear at all. The map displays properly.
I have gone in to the Google Developer's Console and, in the "Credentials" section, have "edited allowed referrers" to be mydomain.com/*
I have also gone in to the Google Developer's Console in the APIs section and enabled 11 Google Maps APIs.
After lots of referrer combinations, deleting and re-creating credentials i realized that i didn't enabled "Google Maps JavaScript API". What a shame. :)
For anyone who is having trouble to get google maps api work please check if the API enabled first.
After struggling a lot with this issue I've found 1 solution for me. It might help people who are searching for a proper and exact solution but not the comments, downvotes and links.
(Map was not displayed in my case.)
If suppose,the link of page where you are loading map is
http://example.com/abc/def/ghi/kpn.php
then give thesame(exactly the same) under Edit allowed references
If you try loading the same page using:
www.example.com/abc/def/ghi/kpn.php
or
http://www.example.com/abc/def/ghi/kpn.php
then your page is loaded but not your map, and this alert is generated.
CONCLUSION
Use the same path(Url address) at these 2 places.
While loading the page which has map.
Under Edit allowed references.
After following this I've got rid from this alert.
First you need to go to https://console.developers.google.com/ and select APIs.
In Google Maps APIs select Google Maps JavaScript API and make sure you enable API for Google Maps JavaScript.
Secondly, you need to create an API key:
Go to Credentials
Create new key and select Browser Key
No need to specify any referrers
So you should see Any referrer allowed after you save.
After a lot of trial and error this worked for me (by Eduardo. Thanks !)
The URL that needs to be authorized is the one in the Referrer header for the requests the browser sends to Google to load the API.
Under Browser Credentials > REFERERS
Add these
.example.org/
www.example.org/*
http://www.example.org
http://example.org
geocodezip provided the info i needed. I was indeed loading the googlemaps library twice: once in my index.html file and once in an iFrame. I changed my code so that the iFrame did not load the googlemaps library but, instead, used the parent. Thanks geocodezip!
Go to APIs menu and find "Google Maps JavaScript API" after you open it just press "Enable API"
I was able to get this to work by deleting all my referrers and allowing all. Apparently there is a bug in the developer console that is causing problems. Some people say that they can get referrers to work by deleting all then adding all back in at once instead of line by line:
https://productforums.google.com/forum/#!topic/maps/mSVyDazRMQo
Previous things I tried:
Regenerating Key
Setting all maps apis to enabled
Hard coding absolute paths of referrers
A side note, when I didn't include my api_key everything worked fined, though I'm sure they will eventually turn you off if you don't use your api_key.
What worked for me was to use Firebug in order to find the exact URL that made the request to the Google Maps API. As stated in Google Maps API documentation on troubleshooting authorization, "How to find the correct URL" part:
The URL that needs to be authorized is the one in the Referrer header
for the requests the browser sends to Google to load the API.
In my case, lets suppose I have a website example.com. In the developer console, under Google Maps API key, I've added many combinations of referrer such as example.com/*, *.example.com/*, example.com, but still the InvalidKeyOrUnauthorizedURLMapError persisted.
My solution, as I've mentioned, to use Firebug: open example.com and look for what was the referrer making request to https://maps.googleapis.com/maps/api/js?..., and it was http://example.com, and that is it. I've added http://example.com/* to the enabled URLs in the Developers Console under my respective API key and now everything works fine.
It is important to know where to look for on Firebug: it is the Net tab. Just click on the request to maps.googleapis ... and look for the Referer
I got it to work by exchanging the keys with my own special created keys AND reading this webpage a few times very carefully. My advice is to add or exchange your Google API Keys at https://console.developers.google.com/apis/credentials before embarking in very complicated scripting.
Insert your own API keys in the very first line of the Google Map javascript:
If you have been setup all configuration like api key etc, and you still got the error,
please enable all your mandatory APIs regarding to google maps.
Like:-
Google Maps Embed API
Google Maps Geocoding API
Google Maps Geolocation API
Google Maps JavaScript API

Google Maps won't work when API key is provided / This page was unable to display a Google maps element

I've been using google maps API V3 for a while now and it was working fine. Yesterday i tried adding Static Maps API to my application and i encountered an error where the image was either not displayed at all or i get an error saying 'InvalidKeyOrUnauthorizedMapError' which tells me something must be wrong with the api key i've been using, but i use the same key with other scripts in my application and they worked fine. I double-checked with developer's console and made sure the Static Maps API is activated and the key is correct. Then i removed the api key from the static image link request and it worked, but i noticed all my other scripts, using this key stopped working displaying these errors:
This page was unable to display Google Maps Element
and the console says:
UrlAuthenticationCommonError: https://developers.google.com/maps/faq#errorcodes .
Regenerating the api key didn't work. Removing the key or using a key from a different account with the same settings in developer's console solves the problem, but i need it to be under this account for billing purposes
TLDR; My application suddenly works only without API key or with a key from another google developer account with the exact same settings. What
may be causing the problem with this particular account?
I guess it was some bug with my account. I disabled and deleted all APIs and keys, re-enabled and re-created them and the problem was fixed.
I fixed,
In the console say to add a link in this format:
*.example.com/*
I changed to this:
*example.com/*
And it worked!

Categories

Resources