Hi Sarath,

I cannot reproduce what you're reporting.  I thought I could at first, but
it would appear not.

In my worksheet feed URLs coming back in the spreadsheets feed, there is
_always_ an xaouth_requestor_id while using 2-Legged OAuth.  I cannot find a
repro case in which the URL is incorrect.  I've tried it numerous times now
in a bunch of different scenarios.

Please try your code again.

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"; xmlns:openSearch="
http://a9.com/-/spec/opensearch/1.1/"; xmlns:gd="
http://schemas.google.com/g/2005";
gd:etag="W/&quot;DE4NQX88eit7ImA9WhdUEUs.&quot;">
...
<link rel="alternate" type="text/html" href="http://docs.google.com"/>
<link rel="http://schemas.google.com/g/2005#feed";
type="application/atom+xml" href="
https://spreadsheets.google.com/feeds/spreadsheets/private/[email protected]
"/>
<link rel="self" type="application/atom+xml" href="
https://spreadsheets.google.com/feeds/spreadsheets/private/[email protected]
"/>
...
<entry gd:etag="&quot;HRUKVQ1AQit7ImBr&quot;">
...
<content type="application/atom+xml;type=feed" src="
https://spreadsheets.google.com/feeds/worksheets/tOKfVp0oUdmU35DnHl7cIKg/private/[email protected]
"/>
<link rel="http://schemas.google.com/spreadsheets/2006#tablesfeed";
type="application/atom+xml" href="
https://spreadsheets.google.com/feeds/tOKfVp0oUdmU35DnHl7cIKg/[email protected]
"/>
<link rel="alternate" type="text/html" href="
https://spreadsheets.google.com/ccc?key=0Atj-hQNOVsTFdE9LZlZwMG9VZG1VMzVEbkhsN2NJS2c
"/>
<link rel="self" type="application/atom+xml" href="
https://spreadsheets.google.com/feeds/spreadsheets/private/full/tOKfVp0oUdmU35DnHl7cIKg?xoauth_requestor_id=m...@mytestdomain.com
"/>
...
</entry>
</feed>

-Vic



On Tue, Sep 27, 2011 at 10:40 PM, Vic Fryzel <[email protected]> wrote:

> 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
>>
>>
>

Reply via email to