Thank you, Trung. This was a big help! It seems that I was on the right track, the code only needed some polishing.
I've checked the code, it was pretty similar to mine, so I've just changed one thing, and it is now working.
For anyone having the same issue: try to inline the get parameters, like in the code above, or this:
Where auth is the String from the first request, starting with: "Auth:"
A few other possible pitfalls I've seen:
- The information that you send in should be the body of the "post" call for the first request, and "get" parameters in the second.
- The Auth string from the first call comes back as content (in the body), not as header/cookie
- For the second call, it's better to turn off redirect following
- You don't need a CookieManager to capture the cookie. You can just look for "Set-Cookie" in the headers
- The expiry date of the cookie depends on your GAE app settings. The default is one day, you can change it to 1 or 2 weeks.