Twitter OAuth getRequestToken失败

时间:2013-02-20 17:03:50

标签: java twitter twitter-oauth

今天,我的Twitter OAuth框架开始失败,以下是什么意思?当我尝试使用“http://twitter.com/oauth/request_token”...任何想法获取请求令牌时会发生这种情况?

堆栈:

 2013-02-20 14:24:47,954 [ajp-8009-67] WARN  org.apache.commons.httpclient.HttpMethodBase - Cookie rejected: "$Version=0; k=206.220.219.228.a1d883477ac32b42; $Path=/; $Domain=.com". Domain attribute ".com" violates RFC 2109: domain must contain an embedded dot
    2013-02-20 14:24:47,954 [ajp-8009-67] ERROR com.web.helper.TwitterDelegate - Fire Eagle authentication failure. Please try again later or contact customer service.
    net.oauth.OAuthProblemException: HTTP/1.1 301 Moved Permanently
            at net.oauth.client.OAuthResponseMessage.toOAuthProblemException(OAuthResponseMessage.java:83)
            at net.oauth.client.OAuthClient.invoke(OAuthClient.java:306)
            at net.oauth.client.OAuthClient.invoke(OAuthClient.java:260)
            at net.oauth.client.OAuthClient.getAccessToken(OAuthClient.java:229)
            at com.api.service.impl.GenericOAuthServiceImpl.getAccessToken(GenericOAuthServiceImpl.java:117)
            at com.api.service.impl.SocialNetworkingServiceImpl.getAuthTokens(SocialNetworkingServiceImpl.java:81)
            at sun.reflect.GeneratedMethodAccessor12755.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:616)
            at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
            at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
            at $Proxy150.getAuthTokens(Unknown Source)
            at com.web.helper.OAuthDelegate.retrieveAuthTokens(OAuthDelegate.java:82)
            at com.web.action.SocialNetwork.setCallbackForm(SocialNetwork.java:215)
            at sun.reflect.GeneratedMethodAccessor1981.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:616)
            at javax.el.BeanELResolver.setValue(BeanELResolver.java:108)
            at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:69)
            at com.sun.faces.el.FacesCompositeELResolver.setValue(FacesCompositeELResolver.java:100)
            at org.apache.el.parser.AstValue.setValue(AstValue.java:143)
            at org.apache.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:249)
            at com.sun.facelets.el.TagValueExpression.setValue(TagValueExpression.java:93)
            at javax.faces.component.UIComponent.processEvent(UIComponent.java:2182)
            at javax.faces.component.UIViewRoot$1.visit(UIViewRoot.java:873)
            at com.sun.faces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:147)
            at javax.faces.component.UIComponent.visitTree(UIComponent.java:1443)
            at javax.faces.component.UIForm.visitTree(UIForm.java:333)
            at javax.faces.component.UIComponent.visitTree(UIComponent.java:1454)
            at javax.faces.component.UIViewRoot.processRestoreState(UIViewRoot.java:868)
            at org.ajax4jsf.component.AjaxViewRoot.processRestoreState(AjaxViewRoot.java:761)
            at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:197)
            at javax.faces.application.StateManagerWrapper.restoreView(StateManagerWrapper.java:178)
            at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:131)
            at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:143)
            at com.sun.facelets.FaceletViewHandler.restoreView(FaceletViewHandler.java:316)
            at com.sun.facelets.FaceletViewHandler.restoreView(FaceletViewHandler.java:316)
            at org.ajax4jsf.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:107)
            at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:199)
            at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
            at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:110)
            at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
            at javax.faces.webapp.FacesServlet.service(FacesServlet.java:310)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
            at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
            at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
            at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:312)
            at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
            at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:324)
            at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:324)
            at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:324)
            at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:324)
            at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:146)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:324)
            at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:324)
            at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:324)
            at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:324)
            at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:324)
            at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:324)
            at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:174)
            at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
            at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
            at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:427)
            at org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProtocol.java:384)
            at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1556)
            at java.lang.Thread.run(Thread.java:636)
    2013-02-20 14:24:47,976 [ajp-8009-67] INFO  com.api.service.impl.GenericOAuthServiceImpl - GETTING REQ TOKEN, CALLBACK URLhttps://login.findmecom.com/com-main-web/mobile/landing.html
    2013-02-20 14:24:48,014 [ajp-8009-67] WARN  org.apache.commons.httpclient.HttpMethodBase - Cookie rejected: "$Version=0; k=206.220.219.228.75dbd59bf0bb469e; $Path=/; $Domain=.com". Domain attribute ".com" violates RFC 2109: domain must contain an embedded dot

Twitter在异常中返回以下内容:

"HTTP request => GET /oauth/request_token?oauth_callback=http%3A%2F%2Flocalhost%3A8080%2Fmy-main-web%2Fmobile%2Flanding.html&oauth_consumer_key=UuuAUY41K974e3DDTvdN2Q&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1361376590&oauth_nonce=414154092249267&oauth_version=1.0&oauth_signature=DEQzMRl40KPqo9%2FVD5XG3R5v7EI%3D
User-Agent: Jakarta Commons-HttpClient/3.1
Host: twitter.com

"
"HTTP status => 301"

"Location => https://twitter.com/oauth/request_token?oauth_callback=http%3A%2F%2Flocalhost%3A8080%2Fmy-main-web%2Fmobile%2Flanding.html&oauth_consumer_key=UuuAUY41K974e3DDTvdN2Q&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1361376590&oauth_nonce=414154092249267&oauth_version=1.0&oauth_signature=DEQzMRl40KPqo9%2FVD5XG3R5v7EI%3D"


"HTTP response => HTTP/1.1 301 Moved Permanently
Location: https://twitter.com/oauth/request_token?oauth_callback=http%3A%2F%2Flocalhost%3A8080%2Fmy-main-web%2Fmobile%2Flanding.html&oauth_consumer_key=UuuAUY41K974e3DDTvdN2Q&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1361376590&oauth_nonce=414154092249267&oauth_version=1.0&oauth_signature=DEQzMRl40KPqo9%2FVD5XG3R5v7EI%3D
Content-Length: 0
Set-Cookie: k=206.220.220.206.dbf3e9c4278a09e7; path=/; expires=Wed, 27-Feb-2013 16:09:52 UTC; domain=.com; httponly
Date: Wed, 20 Feb 2013 16:09:52 UTC
Server: tfe

"

"URL => http://twitter.com/oauth/request_token?oauth_callback=http%3A%2F%2Flocalhost%3A8080%2Fmy-main-web%2Fmobile%2Flanding.html&oauth_consumer_key=UuuAUY41K974e3DDTvdN2Q&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1361376590&oauth_nonce=414154092249267&oauth_version=1.0&oauth_signature=DEQzMRl40KPqo9%2FVD5XG3R5v7EI%3D"

2 个答案:

答案 0 :(得分:1)

答案 1 :(得分:0)

尝试发出安全请求。而不是http://twitter.com,请始终使用https://twitter.com。它对我有用。我希望它有所帮助。