0

Using twitter4j v3.0.3, every aspect of Twitter integration works, except that when authenticating/authorizing my, the browser is redirected to http://api.twitter.com/login which returns "Sorry, that page doesn’t exist!"

This only happens THE FIRST TIME, i.e.browser with a clear cache or an Incognito window. My server reports that it's redirecting to this URL...

http://api.twitter.com/oauth/authenticate?oauth_token=PTlVt6aisFy7UytjsRM5poFHcdGEjGtgNpxhJ8UbQ

...the browser confirms a 302 to...

https://api.twitter.com/oauth/authenticate;jsessionid=pw65se84inj9?oauth_token=PTlVt6aisFy7UytjsRM5poFHcdGEjGtgNpxhJ8UbQ

...and that request generates a 302 to the page which does not exist, i.e.

https://api.twitter.com/login?redirect_after_login=%2Foauth%2Fauthenticate%3Bjsessionid%3Dpw65se84inj9%3Foauth_token%3DPTlVt6aisFy7UytjsRM5poFHcdGEjGtgNpxhJ8UbQ

When the user navigates back from the "Sorry, that page doesn’t exist!" page and then retries, the oauth flow works perfectly.

I'm guessing this is something to do with the appended jsessionid?

This issue is on local development server, but the 404 has also been seen intermittently on GAE production.

Mike
  • 312
  • 3
  • 13

2 Answers2

1

I found the solution here: https://stackoverflow.com/a/19690688/2698327

You identified correctly the problem: GAE append a jsessionid parameter for the first request made by a user (i.e. when the session is created).

To prevent it from doing so you can edit the web.xml and append the following:

<context-param>
    <param-name>org.mortbay.jetty.servlet.SessionURL</param-name>
    <param-value>none</param-value>
</context-param>
Community
  • 1
  • 1
Leo
  • 56
  • 5
0

To be correctly authenticated, you should send appropriate parameters via query parameters in the link such as: consumer key, consumner secret key, access token and access token secret.

If you still get the same page not found error, maybe the twitter account that associated with the authentication parameters was deleted!

mgokhanbakal
  • 1,679
  • 1
  • 20
  • 26
  • As I mentioned above, every aspect of the Twitter integration works. Even the oAuth flows when it is re-tried. This implies that all the parameters are being correctly set within Twitter4J, no? Given that the oAuth flow works when it is re-tried, the associated twitter account has clearly not been deleted. – Mike Nov 20 '13 at 21:47