I'm using geofield and geocoder (and will soon switch to addressfield) on a site behind a VPN, which means that they had to purchase a Google business account to stay within their terms of use. But now I need to specify our client ID and signature in the geocoding http request. Is there a way to do this now? It's just two extra parameters at the end of the geocoding request:

&client=gme-YOUR_CLIENT_ID&signature=YOUR_URL_SIGNATURE

Comments

phayes’s picture

Category: support » feature

Not currently, but yes, we should add support for that

drm’s picture

Status: Active » Postponed

That might be hard to do if you don't have a license to try it with. The signature actually comes from combining a key with the http request and making a hash out of that. I'm not even sure if their documentation for this is accessible publicly, and in any case, it is has a mistake that I needed to have their tech support point out to me.

I will be out of town next week, but will figure it out and post some code for that early in June. I set this case to postponed for now.

drm’s picture

Status: Postponed » Needs review
StatusFileSize
new1.38 KB

The attached file describes how to change google.inc to work with a Google enterprise account. Note the three Drupal variables that it uses. I did not create a standard user interface form for these as I don't know how you want to structure that. So this is just the internals.

Also, there are two functions provided by Google:

function encodeBase64UrlSafe($value)
{
  return str_replace(array('+', '/'), array('-', '_'),
    base64_encode($value));
}

// Decode a string from URL-safe base64
function decodeBase64UrlSafe($value)
{
  return base64_decode(str_replace(array('-', '_'), array('+', '/'),
    $value));
}
phayes’s picture

Hi @drm,

Three things:

1. Could you re-roll this patch in git format please?
2. Could you add the appropriate config options to geocoder.admin.inc
3. variables should be prefixed with "geocoder", so it should be "geocoder_google_ent_crypto_key" etc.

Thanks!

phayes’s picture

Status: Needs review » Needs work
Rob_Feature’s picture

Status: Needs work » Needs review
StatusFileSize
new4.38 KB

I'm not much of a developer but here's a git patch with the changes requested in #4. Please review and reformat as necessary.

Rob_Feature’s picture

That last patch had some issues with it...here's one that we've confirmed is working on our install. It still needs work, no doubt, but it seems to function properly.

simon georges’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Exploratus’s picture

Nice!

bennetteson’s picture

The #7 patch have somes issues. Using variable_get of a setting instead of variable_get of the setting array.

Here a full refactored patch currently used on production.

pol’s picture

Issue summary: View changes

Hi,

Is this patch still valid ?

Thanks.

basvredeling’s picture

Status: Needs review » Needs work

No, this patch no longer applies to current dev.

basvredeling’s picture

Status: Needs work » Postponed (maintainer needs more info)

I've done some research. The current geocoding api (v3) also includes business accounts. See: https://www.google.com/work/earthmaps/legal/us/maps_included_APIs.html
Also in the license terms there is no mention of VPN restrictions as far as I can tell. See: https://developers.google.com/maps/terms

Since January 6 2016 there is a new premium plan for business users which still includes signing requests. See: https://developers.google.com/maps/documentation/geocoding/get-api-key#p... and https://developers.google.com/maps/premium/overview#digital-signatures

There might still be a need for requests with signature instead of api key but let's update this 4 year old issue first before we continue.
I also question if the original issue (VPN related) is still relevant. Hopefully @drm or @Rob_Feature can shed some light on this.

weboperator’s picture

Yes there is still a need for digital signatures of a requests, but not for all purposes. Here you can find the complete information: https://developers.google.com/maps/premium/overview#authentication-and-authorization

Be careful: The usage within a private network or a closed user group requires a special license. With the "standard" Google Maps API Premium license you are not allowed to use it. Such solutions have to be available for a public user group. See section 3.A of SERVICE ADDENDUM: Google Maps APIs Premium Plan at the bottom of Google Maps for Work Master Terms

There is also a limitation on storage and caching of any content. See section 4.6.E of Google Maps for Work Master Terms

pol’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)