Search code examples
ruby-on-railsgoogle-docsgoogle-docs-apiauthsub

Rails Google Data List API AuthSub Token Invalid


I created an authentication using the Documents List API. I have successfully authenticated and can get a token that allows me to see all the documents the user has, but I cannot upload a new document.

I suspect it may be because I am using secure = false for the GData4Ruby AuthSub, but I have changed the API so it is querying http://docs.google.com/feeds/documents/private/full. The Https: version doesn't work either, but probably because I requested an insecure token.

Does anybody know how to fix this? Exact Error:

GData4Ruby::HTTPRequestFailed (<HTML>
<HEAD>
<TITLE>Token invalid</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Token invalid</H1>
<H2>Error 401</H2>
</BODY>
</HTML>
): 

Solution

  • Nevermind, I figured it out. For anyone that had this problem using GDocs4Ruby, in the source for the gem, it is authenticating with a Google Auth token, but I received my token through AuthSub. Therefore, you have to change that post request to not only pass your token but also to label that header as "AuthSub" rather than "Google Auth"