45

I'm currently building a test and trying to get a google+ user location. I'm testing on myself and have set my position to public.

I was originally planning to use Google Latitude, however, since Google is deprecating this API in a few days, my only option is to use the Google+ API.

The parameter currentLocation was added a few months ago

I'm therefore trying to get it. But could not manage to do it.

I've tested on my own server using the PHP API and then the JS API with Oauth2.0, but this damn parameter is never sent back. I can get any other parameter but definitely not that one.

Then I've tested in the google+ explorer, but same thing here, nothing came out

Does anyone have already encounter a similar issue ?

I have a few idea where it could come from :

  1. Does Oauth2.0 does not let me access this information (I've tried any possible data-scope)
  2. Is there just a bug on this functionality ?
  3. Is it restricted to verified users ?
  4. Or maybe it's just not possible ?

Thanks !

Emzor
  • 1,380
  • 17
  • 28
littlebridge
  • 691
  • 6
  • 10
  • 1
    Currently, this isn't working, I'll let you know in an answer if I can get the currentLocation value to return. When it DOES work, you will be able to just get the currentLocation if it is publicly shared from a user's profile. – class Aug 01 '13 at 21:48
  • Has anyone heard anything further on this? I can see that it doesn't appear to work for me either. – Michael Giovanni Pumo Aug 13 '13 at 13:47
  • Thanks for the replies, let's wait then, I'm following this post as well : https://code.google.com/p/google-plus-platform/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Component%20Owner%20Summary%20Stars&groupby=&sort=&id=620 – littlebridge Aug 19 '13 at 16:01
  • 1
    Waiting for the currentLocation attribute to be populated, too. I tried on this link: https://developers.google.com/+/api/latest/people/get – feder Sep 07 '13 at 09:12

3 Answers3

1

Access to location data is restricted to users who have granted you access to their location data at the time that the OAuth token was generated.

You have to specifically request access to location data in the scope parameter.

benomatis
  • 5,536
  • 7
  • 36
  • 59
  • The documentation linked has no details of the scope to specifically request access to location – Rob Jan 23 '14 at 14:42
  • 1
    I have explored this 'solution' above and find it virtually useless. The only thing that could possibly provide location is the 'moment' api and it is confirmed broken by Google, it says they will be fixing it but, of course, there is not expected date. – marty331 Jan 23 '14 at 15:25
  • @atrioom, unfortunately it's not really the solution :( as marty331 is saying the moment api is broken. I have finally canceled the project I was working on since there's no way to accomplish this for the moment. Still looking for a solution or a fix on the long term. – littlebridge Feb 03 '14 at 18:32
  • It's really sad that this interesting API is broken until now.. And no references or explanation given. Also other Google+ APIs are broken, birthday for example.. – mattd Jun 04 '15 at 20:18
  • 1
    The Moment API is deprecated now. – 0xcaff Aug 07 '15 at 23:13
0

This is an old one but still valid question. Even field "currentLocation" is listed as valid reponse People object field, there´s no way to access field´s data.

Was reported as issue in G+ repository but there is no answer so far.

If you are still trying to get user´s current location try the following snippet, not sure if this is the best option but it works :):

Note: "r" holds the client.request() response data (API call)

r.placesLived.forEach(function(l) {
   if (l.primary) 
    console.log(l.value);
});

Hope this helps. Cheers.

Emzor
  • 1,380
  • 17
  • 28
nicofx
  • 56
  • 2
0

What I think is that r.placesLived would only give his location but the location of the user nor the location of the exact machine. It could be remembered that you need to have the address. However, it needs to look for another token for verifying a user's exact location. Going into it might only need more of a tracker and not only a location.

bipartite
  • 91
  • 7