nonceSigner returns 401

1,165 views
Skip to first unread message

Keaton

unread,
Jul 25, 2011, 1:29:50 PM7/25/11
to Google Documents List API
This is one of those problems where I've probably gone horribly astray
somewhere, but I can't figure out where that is. So basically, here's
where I am: Whenever I try to download a Google Docs native file
(document, presentation, etc) it works, but whenever I try to download
an unconverted file, one hosted on docs.googleusercontent.com, I get
redirected to https://docs.google.com/nonceSigner. I have found almost
no mention of such a thing anywhere, but since even the OAuth
Playground leads me there, I'm guessing that's not just user error.
Anyway, once I get to the nonceSigner it returns a 401 error (again,
even in OAuth Playground, and even when "https://
docs.googleusercontent.com/." is in my scope). There is no additional
information, just an HTML error message saying "Error 401". Happens
with both GET and POST. So I'm kind of stuck.

What I find even weirder is that the nonceSigner's callback URL is the
same one I started with, the docs.googleusercontent.com. And, when I
put that URL in my browser, it *sometimes* gets stuck in a loop of
infinite redirects and *sometimes* returns 401. As a programmer, the
word sometimes is very scary.

So, does anybody know what the nonceSigner is and how to make it work?
I can't even figure out how to download these files in the OAuth
Playground, so I get the feeling I'm missing some stupidly simple
piece of information. That happens sometimes :)

-Keaton

Ali Afshar

unread,
Jul 25, 2011, 1:58:58 PM7/25/11
to google-docum...@googlegroups.com
Hi Keaton,

When I get like this, an extra pair of eyes always helps. Can I check
how and if you are using the API? And that you are following the
directions here:
http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#DownloadingDocsAndFiles

If so, it would really help to see your code (or a small test case),
so I can test and try to reproduce.

Regards

--
Ali Afshar | http://gplus.to/aafshar | Google Developer Relations

Keaton Brandt

unread,
Jul 25, 2011, 2:21:42 PM7/25/11
to google-docum...@googlegroups.com
Hi Ali,

My code is a little scattered around, but here's the gist of it (that produces the same results in the OAuth Playground)

1) Get an HMAC-SHA1 access token with "anonymous" as the consumer public and private keys (it's a desktop app). Use "https://docs.google.com/feeds/ https://spreadsheets.google.com/feeds/ https://docs.googleusercontent.com/." as the scope.

2) Obtain a documents list from https://docs.google.com/feeds/default/private/full/

3) Find a non-native document, in this case PDF, and get the src of the content tag (https://doc-08-48-docs.googleusercontent.com/docs/securesc/XXX/XXX/XXX/XXX/XXX/XXX?h=16653014193614665626&e=download&gd=true)

4) Retrieve that URL with OAuth signing. It appears as though the URL doesn't load with "&" instead of "&" in the playground.

5) Server returns a 302 redirect to https://docs.google.com/nonceSigner?nonce=iv38bfjlb63ak&continue=(previous URL)&hash=158p0dnfv7vtt1j8ndgj0qq8hj4nsac2

6) Retrieve that URL with OAuth signing. Server returns 401 error.

I hope that's enough information. I could certainly try to reformat my exact code in order to be, y'know, understandable, if that would help :)

-Keaton

Ali Afshar

unread,
Jul 25, 2011, 2:39:23 PM7/25/11
to google-docum...@googlegroups.com
Hi Keaton,

Thanks for the step-by-step. I can reproduce your problem using the
OAuth playgorund, so I am going to sniff around to see what I can
find. I admit I can't see anything, but perhaps I am missing something
obvious. I'll get back to you as soon as I know.

Regards

IS

unread,
Aug 2, 2011, 4:12:41 AM8/2/11
to google-docum...@googlegroups.com
Hi Ali,
 
I got the same problem as Keaton, but in step 5, server returns a 403 Forbidden error (same results in OAuth Playground) and cannot download the non-native file.
 
Any idea about this? I stuck with this problem for few days.....Hope someone can help.
 
Thanks!!

Ali Afshar

unread,
Aug 3, 2011, 4:14:26 AM8/3/11
to google-docum...@googlegroups.com
Hi,

Is this still affecting you? I am successfully downloading files now
using the step-by-step procedure in this thread.

Regards

--
Ali Afshar | www.googplus.org/ali | Google Developer Relations

IS

unread,
Aug 4, 2011, 4:56:52 AM8/4/11
to google-docum...@googlegroups.com
Hi Ali,
 
For my case, it still affecting me.
 
I just use the OAuth Playground to retrieve the src of the content tag "https://doc-08-bk-docs.googleusercontent.com/docs/securesc/xxx/xxx/xxx/xxx?h=16653014193614665626&e=download&gd=true", but it still returns the response below
 
HTTP/1.1 403 Forbidden
Server: Upload Server Built on Jul 13 2011 17:25:26 (1310603126)
Date: Thu, 04 Aug 2011 08:47:00 GMT
Expires: Thu, 04 Aug 2011 08:47:00 GMT
Cache-Control: private, max-age=0
Content-Length: 0
Content-Type: text/html
 
Any idea??
 
Thanks!!
Reply all
Reply to author
Forward
0 new messages