401:Authentication credentials were missing or incorrect Failed to validate oauth signature and token


#1

we have three environments for the two environments same code is working but not for one environment, i have reset the keys but still i got the same error,

Twitter twitter = new TwitterFactory().getInstance();
twitter.setOAuthConsumer(twitterConfiguration.getConsumerKey(), twitterConfiguration.getConsumerSecret());
RequestToken requestToken = twitter.getOAuthRequestToken();

while try to take the oAuthRequestToken error is coming. Please help me.


#2

Reseting your keys is not really the best step to take when you notice 1 out of 3 environments not working. Instead, I would compare every difference between the environments and rule out a few basics: clocks not in sync with each other, different versions of libraries, misconfigurations, etc.

Whatever library you’re using, the error that’s being returned should encapsulate additional information about the condition. That should also aid you in determining what’s amiss.


#3

I am getting below error while accessing it from the server located at Indonesia. Same is working for me in other integrated sites.Please let me know what the problem might be.

401:Authentication credentials were missing or incorrect.
Failed to validate oauth signature and token
TwitterException{exceptionCode=[68a00bf1-d29b9452], statusCode=401, retryAfter=0, rateLimitStatus=null, version=2.1.6}


#4

If the same exact code works in other places, check that your server time is synchronized with NTP - a clock that is significantly different from Twitter’s server times can cause 401 errors.


#5

i also got this error. strange thing is yesterday, i successfully sent a tweet using the same code im using now.
but today, i’m getting this error.


#6

Last time code woks fine but when i ran the code next time i got this error… don’t know exactly what is the problem…

TwitterException{exceptionCode=[68a00bf1-d29b1ff3], statusCode=401, retryAfter=0, rateLimitStatus=null, version=2.1.5-SNAPSHOT(build: d372a51b9b419cbd73d416474f4a855f3e889507)} at cfindex2ecfm1656959529.runPage(C:/ColdFusion10/cfusion/wwwroot/Demo1/index.cfm:5)

TwitterException{exceptionCode=[68a00bf1-d29b1ff3], statusCode=401, retryAfter=0, rateLimitStatus=null, version=2.1.5-SNAPSHOT(build: d372a51b9b419cbd73d416474f4a855f3e889507)}
at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:308)
at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:72)
at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:103)
at twitter4j.http.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:123)
at twitter4j.TwitterOAuthSupportBaseImpl.getOAuthRequestToken(TwitterOAuthSupportBaseImpl.java:87)
at twitter4j.Twitter.getOAuthRequestToken(Twitter.java:54)
at twitter4j.TwitterOAuthSupportBaseImpl.getOAuthRequestToken(TwitterOAuthSupportBaseImpl.java:80)
at twitter4j.Twitter.getOAuthRequestToken(Twitter.java:54)
at sun.reflect.GeneratedMethodAccessor36.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at coldfusion.runtime.java.JavaProxy.invoke(JavaProxy.java:97)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2432)
at cfindex2ecfm1656959529.runPage(C:\ColdFusion10\cfusion\wwwroot\Demo1\index.cfm:5)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:244)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:444)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.IpFilter.invoke(IpFilter.java:64)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:443)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:112)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:30)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:94)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)
at coldfusion.CfmServlet.service(CfmServlet.java:204)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:414)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)


#7

here u can do few things.

first go to https://dev.twitter.com/ and go to settings block and Change the permission of Read only to
Read, write, and direct messages
and update that information and run the program and in case if it is not happening the recreate the token and try again with config of twitter factory again and Add Required Jar again to your class path…


#8

The Final solution may be re-set your device clock to your Timezone time, It works for my problem