How to retrieve Google Maps client id? - javascript

I copy this code to create my first program with maps in java script
<script src="http://maps.googleapis.com/maps/api/js?client=gme-&sensor=false&v=3.7" type="text/javascript"></script>
When I run this program I got error message:
Google has disabled use of the Maps API for this application. This site is not authorized to use the Google Maps client id provided. If you are the owner of this application, you can learn more about registering URLs here: http://code.google.com/apis/maps/documentation/premier/guide.html#URLs
I saw that I need to add the parameter client to the link.
How I can know what is the ID of my client?

From the page you link to:
When registering for Google Maps API for Business, you will receive this client ID from Google Enterprise Support.

Related

Google Maps API Error: This API key is not authorized to use this service or API. Places API error: ApiTargetBlockedMapError

I've started getting this error from a Google Maps widget within a CMS I use:
This API key is not authorized to use this service or API. Places API error: ApiTargetBlockedMapError
The error message provides a helpful link to this page, which includes the following text:
ApiTargetBlockedMapError Error
The Maps JavaScript API has not been authorized for the used API key.
Please check the API restrictions settings of your API key in the
Google Cloud Platform Console.
See API keys in the Google Cloud Platform Console. For more
information, see Using API Keys.
I know Google has tweaked this API in the past, so I went to the console and checked the permissions given for the key I am using. It includes these four permissions, include the Maps JavaScript API permission:
Geocoding API
Maps Embed API
Maps JavaScript API
Maps Static API
The only part not working is the address auto-complete. When I change to Don't Restrict Key mode so the key works with all services, it works fine. Any idea which service checkbox I might be missing? I'm wondering if Google is just displaying the wrong error.
Any ideas?
This is what I did. Updated.
Make sure you have enabled all the next Google Maps Services
If you have key restrictions, make sure you add the services like the next image..
Restart the project. It worked.
It turns out that Google has tweaked their permissions settings without updating the error. I had to give access to the Places API as well for the autocomplete to function.
I've submitted a PR to the CMS widget's documentation:
https://github.com/Frojd/wagtail-geo-widget/pull/59/files

Downloading Google Analytics Data By Client_id

I'm allowing users of my site to download their google analytics data at their free will for transparency sake and I don't want to deal with CCPA requests for data myself.
I'm using Node.js as my backend and was wondering if it's possible to download google analytics by client_id. I'm using a service account for my google console access.
If there's some documented api endpoint that I'm not seeing that would help a lot.
Sure you have, it came in for that purpose
The User Activity API allows a Google Analytics property owner to
retrieve all analytics measurement data associated with a single user.
Specifically, the API retrieves all of the measurement data associated
with a particular User ID or Client ID.
https://developers.google.com/analytics/devguides/reporting/core/v4/user-reporting

Google Maps Error :This page didn't load Google Maps correctly. See the JavaScript console for technical details

I am developing a android application using cordova and I am facing a issue regarding google maps javascript api.
We have a purchased API and included it in the following format ..
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&client=<?php echo MAP_CLIENT; ?>&signature=<?php echo MAP_SIGNATURE; ?>"></script>
Using this particular script works absolutely fine in the web browser but is showing a error as follows.
Oops! Something went wrong. This page didn't load Google Maps
correctly. See the JavaScript console for technical details
As you are using the Premium plan with a client parameter you should authorize the URL you are loading an API from in your Google cloud support portal.
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 Cloud Support Portal.
In the left-hand menu, click Maps: Manage Client ID.
You can add up to 100 URLs at a time. A Client ID may be associated with up to 3000 authorized URLs. If you expect your application to host Google Maps content from more than 3000 locations, you should switch to using API keys instead.
source: https://developers.google.com/maps/documentation/javascript/get-api-key#registering-authorized-urls
In order to figure out what is the URL that you should authorize, check the value of the window.location.href in you hybrid app. This value should be added to the list of authorized URLs.
Also note that Maps JavaScript API doesn't have signature parameter. You must delete it, especially if you expose there your cryptographic key which must be private.
I hope this helps!

Use Google Apps Script Execution API with API keys and Javascript

I want to create a web application for my client and use Google drive to store information.
Since it's impossibe to integrate a web application from google apps script in my own website I try to use Google Apps Script Execution API and Javascript to make the interaction between my website and Google Drive.
I find out some exemple like this one :
https://mashe.hawksey.info/2015/10/google-sheets-as-a-database-authenticated-insert-with-apps-script-using-execution-api/
I do be able to reproduce this example but it use an Auth authentification.
I would like to use Google Apps Script Execution API without Auth authentification but with simple API keys.
Is it possible ? And do you have an example to illustrate this.
Thank you for your help,
Yes you can do that. Check this guide about web deployment using apps script. You just need to run the web app as your own user (parameter Execute the app as). But you will only be able to get access to your own google Drive which may not be that useful. If you want to access others' people Drive then you must run the web app as the current user but this will prompt for permissions (the first time the user access your application).

This site or IP is not authorized to use this API key

I am trying to render google maps with the following link inside QlikView application
http://maps.google.com/staticmap?center=23.01,84.49&zoom=5&maptype=roadmap&size=640x400&key=XXXXXXXXXXXXXXXXXXXXXX&.jpg
(I have created a BROWSER API key)
The error message I am getting is (not in QlikView, but in browser, when I try to render the link using browser):
The Google Maps API server rejected your request. This site or IP is not authorized to use this API key.
I have actvated following Google services on my account:
Google Maps Android API v2
Google Maps JavaScript API v3
Static Maps API
Translate API
Already found this thread on StackOverflow: The Google Maps API server rejected your request
I have tried the following:
make sure the Referers is set to Any referer allowed
Make sure you have enabled "Static Maps API" service in addition to "Google Maps API".
Unfortunately, I am still getting the same error message.
Can anyone help please? Thanks.
generate key from https://console.developers.google.com/ for maps api of type browser key. And make sure that while calling document.referrer should be set to your domain.
Google API keys are binded to Domain Names, if you request a Google Service from a site that is not whitelisted the request gets tossed.
Go to your Google Console. https://console.developers.google.com/
Click in the left Menu API's & Auth then Credential
Under Public API access click create new key and choose on the next Page Browser Key. You are now forced to enter all Domain Names that are allowed to make API request with this key.
Enter your Domain names use the new key and you should ready to go.

Categories

Resources