Possible to request gsessionid without a 302 response

我与影子孤独终老i 提交于 2019-12-13 02:48:59

问题


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:

  1. 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.)
  2. Use the gsessionid query parameter located within the redirect's Location: header.
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!