Website Restrict Google Maps API key dynamicly via SDK - google-maps

my question: Is there any Google API / SDK I can use to be able to dynamically add "HTTP referrers (web sites)" (assign domains) to maps API key ?
Background
I'm building a web-application portal that will allow anyone to create a business website and assign a custom domain to it.
On that generated website customer will have google maps map pointing to address of their business.
Customer has an option to add custom domain to their business website created by my web-application (by CNAME to the my web-application)
Desired feature is that once the domain background job will get triggered that will add that domain/host to list of restricted domains/hosts for my Google Maps Api key so that their domain will be able to read google maps on their domanin
note: I Have cron job DNS lookup validation check implemented to ensure that domain is really assigned to the domain
live example
here is website generated by customer on my web-application http://sbs-sos.sajtka.sk/ he assigned a domain and pointed CNAME http://sbs-sos.sk/
Reason why the google map works is because I manually white-listed their domain. I need to automate this
please aware portal is not fully launched so many bugs are happening

The feature request to manage API keys restrictions via SDK was submitted in Google issue tracker in 2016:
https://issuetracker.google.com/issues/35829646
Currently, there are no any official SDK for that. However, the last update from Google says that they released experimental API to programmatically manage your API Keys and their restrictions.
The best way to handle thousands of authorized domains is to use an API to programmatically manage your API Keys and their restrictions, and we have recently launched a new service that allows you to do this.
This API is still in Alpha. If you are interested in becoming a Trusted Tester for this service, you can use the following form to sign up, please read the instructions carefully:
https://forms.gle/qx2SMcarWCAsbWVp7
Please note that this API is not part of the Google Maps Platform. After you fill out the form, you will be contacted by the API Keys API team with instructions on how to get started, and how to receive support.
API Keys API is currently free of charge. However, please note that use of Cloud Endpoints may be subject to charges at high traffic volume. You can check the pricing sheet here:
https://cloud.google.com/endpoints/pricing-and-quotas
I would suggest joining Trusted Tester program and try out this API.
I hope this helps!

Related

Google map API key credential additional methods

I have received a Google Map API Key and it seems to work just fine. Looking on the credential page of the GCP I see there are some alternate methods that I don't see documented anywhere. I have attached a screen shot of the specific page I am referring to, but I was wondering if anyone could give me insight on how to use these methods (OAuth and Service Accounts) or where I might find more documentation.
Thank you.
OAuth 2.0 Client IDs and Service Accounts may not be needed for Google Maps APIs. You will only need API keys to authenticate Google Maps APIs requests as explained here, so I think you can ignore the others.
But to give you an insights, as per the documentation here:
OAuths 2.0 Client IDs are used to allow your apps to access other Google Cloud products on behalf of the user.
Service Accounts are accounts that used by an app to make authorized API calls for other Google Cloud products. You can learn more here: https://cloud.google.com/iam/docs/service-accounts

Is it possible to use multiple Google Map Account under same Application?

I have a Web Application, which is hosted under a domain (say www.xx.com) and I have activated Google Map Account (say, MyAccount) for that Application as well. The Google Map Key under MyAccount; I have enabled for JavaScript Map API and Geocoding API only. There is another option in that Application, which uses Places API, which I haven't enabled due to the heavy costing for that what google have. But, one of my client want to use the Places API option and they have suggested me that to use Client Google Map Account (say, ClientAccount) for that particular Option; where I'll use their Map Key (under ClientAccount) while they sign-in into the Application. So, the following questions became relevant;
-Is it possible to use Dynamic Map Key under one Project?
Is there any violation of Terms? if yes,
- What is the alternative I can suggest to the client to achieve this requirement?
NB: I cannot make another instance of the application to host for the client as my services are under SaaS model.
Thanks,
Shenulal
Yes this should be possible, just send the customer's key with your Places API requests, and make sure they whitelist your domain in their key restrictions.

Is there possibility for registering URLs or domains in Google Maps API?

Is there a way to register Authorized URLs in Google Maps via an API?
Currently, I am manually adding URLs through the Google Maps Support portal, but I would like to be able to make an API call when a customer submits a new domain to my service.
Unfortunately, currently there is no way to manage API key restrictions programatically.
There is a feature request in Google issue tracker to make it possible:
https://issuetracker.google.com/issues/35829646
Please star this feature request to add your vote and subscribe to notifications, at the moment it has only 6 stars, not enough to increase its visibility.
Update from Google
The best way to handle thousands of authorized domains is to use an API to programmatically manage your API Keys and their restrictions, and we have recently launched a new service that allows you to do this.
This API is still in Alpha. If you are interested in becoming a Trusted Tester for this service, you can use the following form to sign up, please read the instructions carefully:
https://forms.gle/qx2SMcarWCAsbWVp7
Please note that this API is not part of the Google Maps Platform. After you fill out the form, you will be contacted by the API Keys API team with instructions on how to get started, and how to receive support.
API Keys API is currently free of charge. However, please note that use of Cloud Endpoints may be subject to charges at high traffic volume. You can check the pricing sheet here:
https://cloud.google.com/endpoints/pricing-and-quotas

Google API key Vs. Google Client ID

One of our customers is using google maps with a "Client ID". We've developed our product using the Google API Key. All of the features of the map are working properly using the API key, but we are unable to confirm that the client will get the same results with the Client ID since we do not have one. Two question, do you believe that the features will work the same using either the API or the Client ID? Second question, how much does it cost to purchase a Client ID?
Client IDs and API Keys are forms of authentication and authorization. There are easy-to-follow guidelines on their proper usage and their limits. Everything you need to know about them can be found in the documentation (also try seeing the docs per product in the 'For more information' section):
https://developers.google.com/maps/premium/overview#authentication_and_authorization
Related SO post and answer about using Client IDs for their Javascript API:
google maps api javascript usage
For pricing, read more about it here:
https://developers.google.com/maps/pricing-and-plans/
EDIT: There has been recent Google Maps Platform pricing and product changes You'll always need an API key and a valid billing account associated to your Project if you want to use the Google Maps Platform APIs. If you've never had a Client ID then you don't need to worry about it, just continue using your API keys.
You may run into some APIs (i.e. Speed Limits API) that seem to need a Premium Plan account. If you really need access to these, simply contact sales using this form.
P.S.
When using API keys, be sure to properly restrict them!

Access Denied when attempting to use Google Maps Geocoding Service with a Console API Key

UPDATE: In an effort to give a more clear question. How do I use the Google Console API key with the Google Maps Geocoding Web Service API? At the moment the request comes back as denied, when I specify the key but even though it failed it is logged in the Google Console API site's reports section.
Original Question
I have an existing app that has been modified to start geocoding address at the time they are entered (for use within the app on a Google Map). The volume expected for this is expcted to be within the free offering's limites and does not require a key at this time. However now I have to geocode all of the existing addresses. I have a small windows app (C#) that will loop through them one at a time, request they be geocoded (via https://maps.googleapis.com/maps/api/geocode/json) and store the results in the database. However I keep running into the query limit. To help alleviate this I've setup an account on Google API Console (https://code.google.com/apis/console/) so that I get go over the limit and just be billed for the overages.
The problem is in order to do utilize this billing alternative I have to provide a Console API Key to the request, but every time I do so I get a response back with a status of REQUEST_DENIED.
My URL looks like this
https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA+94043&sensor=false&key=123abc
If I take off the key it works fine, but with it on it fails. Now, I have seen other questions similar to this when looking around but can find no answer to the issue.
I've tried various alternate domains including maps.google.com, maps.googleapis.com and maps-api-ssl.google.com all seem to have the same problem from what I can tell.
Here's what I've been able to find out so far:
The service is listed in the Google Console API's site as Google Maps API v3, (there is a separate entry for v2) so I don't think it's a problem with keys no longer being mandatory in v3.
I know the requests are getting through and being correctly logged against this API key because with each failed attempt the request count goes up by one on the Reports tab of the Google APIs Console.
*I know it's not a problem with it not being accessed via a web page because the Console API explicitly lets you generates keys intended for Server/Service use and you can restrict access to them via IP address, not URL Referrer.
*I've also verified the parameter syntax as it's outlined on this page, as are other usage
*These seem to be generic to the Console API system but there is no mention of exceptions to these practices when used for the Google Maps API.
I even tried to contact Google but apparently they don't offer support over the phone (I was hoping to be done with this today but that's not looking likely).
It seems the key is not necessary anymore, since it doesn't increase your limit of free geocodings.
It was a legacy of v2, but geocoding API v2 was fully deprecated last March, 8.
If you need to use more than the free limit, I think you must adquire the Enterprise license.
Regards,
Eduardo.
I ran into this same issue and solved it by enabling the Geocoding API on the Google apis dashboard. Even though I'm using the Google Maps JavaScript API v3, it still required me to enable the Geocoding API as well. Make sure you understand the google's quota limits and billing system before enabling any API access. Hope this helps!
Late to this answer, but just in case anyone else has issue. Billing needs to be setup first and like Dylan said you also have to enable Geocoding API(this got me). At least I did for my locations app that shows multiple store location addresses.