I tried to replicate this using the OAuth2 playground but following the 
redirect worked without any errors. Are you using OAuth2 to authorize these 
requests?

Best,
- Eric

On Wednesday, June 17, 2015 at 6:42:29 PM UTC-4, Eric Peters wrote:
>
> I'm not sure how recently this was changed, but I just noticed it.
>
> When using the Spreadsheets API, a redirect is now being sent back 
> (com.google.gdata.util.RedirectRequiredException) 
> but even if you try to parse that and make a new request - you get another 
> gdata error relating to java.lang.IllegalArgumentException: Trying to set 
> foreign cookie (spreadsheets.google.com host doesn't match the 
> docs.google.com)
>
>
> def makeRequest(url: URL): String = {
>   val request = service.createEntryRequest(url)
>
>   try {
>     logger.info("Google Docs Export: "+url)
>     request.execute()
>     InputStreamResource(request.getResponseStream()).readToString("UTF-8")
>   } catch {
>     case e: com.google.gdata.util.RedirectRequiredException => 
> makeRequest(new URL(e.getRedirectLocation))
>   } finally {
>     request.end()
>   }
> }
>
> fm.util.GoogleDocs  -  Google Docs Export: 
> https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=1x2KBxXxqFzUWmbbYR9qT1mme0_Ra4-oVf1WWR4As0-Q&gid=0&exportFormat=tsv
> fm.util.GoogleDocs  -  Google Docs Export: 
> https://docs.google.com/spreadsheets/d/1x2KBxXxqFzUWmbbYR9qT1mme0_Ra4-oVf1WWR4As0-Q/export?gid=0&exportFormat=tsv
> fm.util.GoogleDocs  -  Caught unhandled exception: 
> java.lang.IllegalArgumentException: Trying to set foreign cookie
>
>
> What happened before I handled the redirect:
>
> fm.util.GoogleDocs  -  Calling GoogleDocs API...
> fm.util.GoogleDocs  -  Google Docs Export: 
> https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=0Ai7IYcrzwmCMdFloak50NGN5cmZlWkVqbXRYMmR2aXc&gid=0&exportFormat=tsv
> fm.util.GoogleDocs  -  Caught unhandled exception: 
> com.google.gdata.util.RedirectRequiredException: Moved Temporarily
> <HTML>
> <HEAD>
> <TITLE>Moved Temporarily</TITLE>
> </HEAD>
> <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
> <H1>Moved Temporarily</H1>
> The document has moved <A 
> HREF="https://docs.google.com/a/frugalmechanic.com/spreadsheets/d/1HJ-wP0oEPMP9Kz1f17wOabbfXhsqkgk0hHGoBEVmrX8/export?gid=0&amp;exportFormat=tsv";>here</A>.
> </BODY>
> </HTML>
>
> Any thoughts? this doesn't seem to matter if I do the same request on a 
> non-Google Apps account vs a Google-Apps account.
>
> Thanks,
>
> -Eric
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Spreadsheets API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to