Sarath, This is a bug. I'm looking into it.
Thanks, -Vic On Tue, Sep 27, 2011 at 3:34 PM, Sarath K S <[email protected]> wrote: > Hi All, > > I am getting "com.google.gdata.util.AuthenticationException: Unknown > authorization header" exception while trying to get worksheet feed. > This code was working till today morning. Now suddenly its giving this > error. I am using 2-legged OAuth for authentication. This is the > sample code which throws me the exception. Till now it was working. > This application was on live for more than one year. > > > package com.cordys.external.google; > > import java.io.IOException; > import java.net.URL; > > import com.google.gdata.client.authn.oauth.GoogleOAuthParameters; > import com.google.gdata.client.authn.oauth.OAuthHmacSha1Signer; > import com.google.gdata.client.authn.oauth.OAuthSigner; > import com.google.gdata.client.spreadsheet.SpreadsheetService; > import com.google.gdata.data.spreadsheet.SpreadsheetEntry; > import com.google.gdata.data.spreadsheet.WorksheetFeed; > import com.google.gdata.util.ServiceException; > > public class GoogleDocsManager > { > private static final String CONSUMER_KEY = ""; > private static final String CONSUMER_SECRET = ""; > private static final String SPREADSHEETURL = ""; > private static final String USER_EMAIL_ID = ""; > private static final String CONSUMER_KEY = ""; > > public static void main(String[] args) { > try { > SpreadsheetService service = new > SpreadsheetService("Cordys- > ProcessFactory-Test"); > service.setHandlesCookies(false); > > GoogleOAuthParameters oauthParameters = new > GoogleOAuthParameters(); > oauthParameters.setOAuthConsumerKey(CONSUMER_KEY); > > oauthParameters.setOAuthConsumerSecret(CONSUMER_SECRET); > > OAuthSigner signer = new OAuthHmacSha1Signer(); > > service.setOAuthCredentials(oauthParameters, > signer); > > String url = SPREADSHEETURL + > "?xoauth_requestor_id=" + > USER_EMAIL_ID; > > SpreadsheetEntry sEntry = service.getEntry( new > URL(url), > SpreadsheetEntry.class ); > WorksheetFeed feed = service.getFeed( > sEntry.getWorksheetFeedUrl(), > WorksheetFeed.class ); > } catch (Exception e) { > e.printStackTrace(); > } > } > } > > Now when I appended "?xoauth_requestor_id=" + USER_EMAIL_ID; to > sEntry.getWorksheetFeedUrl(), it started working. Now what should I > do? I should append this xoauth_requestor_id to even to the URLs > returned from Google. And whether someday it will start failing again? > > How we will be able to know some changes are happening in Google side > and we need to update our code? > > Thanks & Regards, > Sarath > >
