Kuba Orlik
Kuba Orlik

Reputation: 3500

Can't connect to Google Latitude API in Apps Script

I want to create an application in Apps Script that would fetch my Latitude Location History. For some reason, even if provided with all the URIs and tokens that seem to be required for OAuth to work, I always get an "Unexpected error" on the line that triggers "UrlFetchApp". What is the proper OAuth configuration that would get Latitude API to work in Apps Script?

here's the code:

function latitude(){
 var oAuthConfig = UrlFetchApp.addOAuthService("latitude");
 oAuthConfig.setConsumerKey(consumerKey);
 oAuthConfig.setConsumerSecret(consumerSecret);
 oAuthConfig.setAuthorizationUrl("https://accounts.google.com/o/oauth2/auth");
 oAuthConfig.setAccessTokenUrl("https://accounts.google.com/o/oauth2/auth");
 UrlFetchApp.addOAuthService(oAuthConfig);
 var response = UrlFetchApp.getRequest("https://www.googleapis.com/latitude/v1/currentLocation");
 Logger.log(response);
}

Upvotes: 0

Views: 367

Answers (1)

Eric Koleda
Eric Koleda

Reputation: 12673

The Google Latitude API only supports OAuth2, and Google Apps Script currently only supports OAuth 1.0a.

Upvotes: 1

Related Questions