Google APIs Client Library for JavaScript Returning "Insufficient Permission"

721 views
Skip to first unread message

Wadih Antoun

unread,
May 27, 2013, 2:13:48 PM5/27/13
to google-la...@googlegroups.com
I'm using the Google APIs Client Library for JavaScript but I keep getting 403 responses "Insufficient Permission" with latitude.

It's authorising ok but I can't get or insert locations. I'm using this function to insert a location:
function makeApiCall() {
        gapi.client.load('latitude', 'v1', function() {
          var request = gapi.client.latitude.location.insert({
"timestampMs":"1274057512199",
"latitude":37.420352,
"longitude":-122.083389,
"accuracy":130,
"altitude":35
});
          request.execute(function(resp) {
            console.log(resp);
          });
        });
      }

This is the response I'm getting:
{"code":403,"message":"Insufficient Permission","data":[{"domain":"global","reason":"insufficientPermissions","message":"Insufficient Permission"}],"error":{"code":403,"message":"Insufficient Permission","data":[{"domain":"global","reason":"insufficientPermissions","message":"Insufficient Permission"}]}}

 I have my API Key & the Client ID. I don't understand what more I need get permission!?

Chris Birkett

unread,
May 28, 2013, 12:09:21 PM5/28/13
to google-la...@googlegroups.com
Did you include the appropriate scope in your OAuth2 request?

Brian Gaugler

unread,
May 28, 2013, 12:11:23 PM5/28/13
to google-la...@googlegroups.com

Does the token need to be refreshed? 

On May 28, 2013 12:09 PM, "Chris Birkett" <ch...@cjbirkett.co.uk> wrote:
Did you include the appropriate scope in your OAuth2 request?

--
You received this message because you are subscribed to the Google Groups "Google Latitude API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-latitude...@googlegroups.com.
To post to this group, send email to google-la...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-latitude-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Wadih Antoun

unread,
May 29, 2013, 2:53:37 AM5/29/13
to google-la...@googlegroups.com
I am including this as the scope: 'https://www.googleapis.com/auth/latitude.current.best'
And I don't think the token needing a refresh is the problem as this happens even right after you authorize.
I think the problem is that I'm using the wrong functions maybe.
For example I've been using gapi.client.latitude.location.get()to get the latest location and it would return "Insufficient Permission". I found it in one online blog that the function is actually: gapi.client.latitude.currentLocation.get().

So maybe the gapi.client.latitude.location.insert() is wrong as well.
if I try gapi.client.latitude.currentLocation.insert() I get a 400 "Invalid Value" response.

So where can I get a list of the Latitude function names for the Google API Javascript Client? I just want the proper function to insert a Latitude position.

Wadih Antoun

unread,
May 29, 2013, 2:59:41 PM5/29/13
to google-la...@googlegroups.com
This is the function I'm using at this point:
gapi.client.load('latitude', 'v1', function() {
              var request = gapi.client.latitude.currentLocation.insert({
                  "data": {
                      "kind":"latitude#location",
                      "latitude":37.420352,
                      "longitude":-122.083389,
                      "accuracy":130,
                      "altitude":35
                  }
              });
              request.execute(function(resp) {
                  console.log(resp);
              });
          });

I'm getting a 400 "Invalid Value" response! What is the invalid value?
WHy is this so hard! Latitude only has 3 functions!!!

Wadih Antoun

unread,
Jun 3, 2013, 2:29:45 AM6/3/13
to google-la...@googlegroups.com
Anyone!?
Reply all
Reply to author
Forward
0 new messages