问题
I've integrated Twitter for Android using this tutorial
It used to run normally, but suddenly it started showing the following error:
05-23 23:17:12.492: W/ResponseProcessCookies(17376): Invalid cookie header: "set-cookie: guest_id=v1%3A136932583219426033; Domain=.twitter.com; Path=/; Expires=Sat, 23-May-2015 16:17:12 UTC". Unable to parse expires attribute: Sat, 23-May-2015 16:17:12 UTC
After showing the login page in a browser and starting to login, it shows an authorize page. When I try to authorize from this page, I am not returned to my application like I expected. How can I fix this?
回答1:
Your expires needs to be in the format:
Sat, 23 May 2015 16:17:12 GMT
Lose the dashes and your TZ needs to be GMT.
Assuming that you are using SimpleDateFormat, this is equivalent to the format string:
"EEE, d MMM yyyy HH:mm:ss zzz"
To set the timezone to GMT:
formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
来源:https://stackoverflow.com/questions/16719134/invalid-header-cookie-when-integrate-twitter-in-android