Using cURL to download CSV file?

Hi All!

I am using a Google ODK Aggregate Server (any Google account can see

I'd like to script the downloading of the CSV file with the results.
I've found a bit of documentation on how to do it, but something just
isn't working. I was hoping someone could offer some advice.

I've used these sites:

And come up with the following procedure (running in bash on Linux):

  1. AUTH=$(curl -d
    Email=email -d Passwd=passwd -d accountType=GOOGLE -d source=Google-
    cURL-Example -d service=apps | cut -d= -f2) which returns the
    variable $AUTH that looks like "DQAAAKQAAADccA6mq..."
  2. curl --
    header "Authorization: GoogleLogin $AUTH"

The first step appears to be working, as I get some form of
authentication string back. When the second command is run passing in
that authentication string, I always get back the same HTML formatted
error telling me that a Login is required:

Open Data Kit Aggregate

Open Data Kit Aggregate

Login Required

Please log in

I thought it might be the fact that I wasn't using the right service
name, so I used the second link I mentioned above and tried each one
with no success. I've also tried the string "ah" as mentioned in the
returned HTML error posted above.

I'm completely stumped. Does anyone have any suggestions on something
else to try? Thanks in advance for any help.