问题
I'm writing a google gdata API client in Flash/AS2 (sadly, moving to AS3 is not an option at this time). Logging in via ClientLogin works fine but subquent requests will return a 302 redirect that includes a gsessionid I am supposed to include with future requests to avoid the 302s.
Flash/AS2, AFAIK, does not allow me to actually query an http error response body in any way, so there's no way for me to actually see this gsessionid after the 302 is returned. Is there a gdata api call which will return me a valid gsessionid inside an HTTP 200 response if I already have a valid GoogleLogin auth token, or is this not possible without a man-in-the-middle proxy?
回答1:
The only Google Data API that should return a gsessionid is the Calendar Data API. None of the others do this, to my knowledge.
That being said, in general there's options here:
- Scrape the gsessionid query parameter from the redirect body, which it sounds like you tried. (In general, this is fragile and not a good idea.)
- Use the gsessionid query parameter located within the redirect's
Location:
header. - The redirect will also contain an
S=
cookie. If you can make sure this cookie gets set for future requests, Google Calendar will use it in place of a gsessionid query parameter.
If neither of these will work for you, your only option is to write a proxy. There's no way to get the gsessionid outside of the redirect, and the Calendar Data API won't serve requests without it.
来源:https://stackoverflow.com/questions/1949171/possible-to-request-gsessionid-without-a-302-response