spring-attic / spring-social

Allows you to connect your applications with SaaS providers such as Facebook and Twitter.

Home Page:http://projects.spring.io/spring-social

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ResourceAccessException : https://api.twitter.com/oauth/request_token. Connection timeout

latika-bhurani opened this issue · comments

Sometimes login is successful and sometimes it fails.

A connection timeout is usually a network issue or a problem at Twitter itself. There's not much that Spring Social can do about that. But, how Spring Social reacts to such things is something that can be addressed. Can you describe (perhaps with screenshots) what you see when this happens?

I'm guessing that the exception somehow manifests itself in the browser when it flows up through one of the controllers or filters. This has me wondering: Is this happening at signin (with either ProviderSignInController or SocialAuthenticationFilter) or connect time (ConnectController)?

We have apache as webserver which delegates the request to tomcat server.

Since apache has 5 min timeout the browser give 502 proxy error.

The issue is reproducible whenever we leave the screen idle for 5-10 min and then try to login.

This issue is coming up from ProviderSignInController. Following is the stack trace :

org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://api.twitter.com/oauth/request_token":Connection timed out; nested exception is java.net.SocketException: Connection timed out at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:607) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:572) at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:493) at org.springframework.social.oauth1.OAuth1Template.exchangeForToken(OAuth1Template.java:192) at org.springframework.social.oauth1.OAuth1Template.fetchRequestToken(OAuth1Template.java:117) at org.springframework.social.connect.web.ConnectSupport.fetchRequestToken(ConnectSupport.java:212) at org.springframework.social.connect.web.ConnectSupport.buildOAuth1Url(ConnectSupport.java:199) at org.springframework.social.connect.web.ConnectSupport.buildOAuthUrl(ConnectSupport.java:126) at org.springframework.social.connect.web.ProviderSignInController.signIn(ProviderSignInController.java:180) at sun.reflect.GeneratedMethodAccessor286.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

Make sure you have filled a Callback URL field in Twitter App Management page. It's not required but looks like it must be there.