2

I am trying to run a Java .jar file on my remote Linux Amazon AMI server. Locally, when I run this Java project a permanent HTTP connection is established and everything works as expected. If I run this on my server though, I get an authentication error. I have to authenticate via OAuth1 in order to get access to Twitter's servers which works perfectly on my local machine. Do I have to install something on my server in order to support OAuth or the like ?

16214 [hosebird-client-io-thread-0] DEBUG org.apache.http.impl.client.DefaultHttpClient  - Authentication required
16214 [hosebird-client-io-thread-0] DEBUG org.apache.http.impl.client.DefaultHttpClient  - userstream.twitter.com:443 requested authentication
16214 [hosebird-client-io-thread-0] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy  - Authentication schemes in the order of preference: [negotiate, Kerberos, NTLM, Digest, Basic]
16214 [hosebird-client-io-thread-0] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy  - Challenge for negotiate authentication scheme not available
16215 [hosebird-client-io-thread-0] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy  - Challenge for Kerberos authentication scheme not available
16215 [hosebird-client-io-thread-0] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy  - Challenge for NTLM authentication scheme not available
16215 [hosebird-client-io-thread-0] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy  - Challenge for Digest authentication scheme not available
16215 [hosebird-client-io-thread-0] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy  - Challenge for Basic authentication scheme not available
16215 [hosebird-client-io-thread-0] WARN com.twitter.hbc.httpclient.ClientBase  - hosebird-client-0 Error connecting w/ status code - 401, reason - Unauthorized
Jonathan
  • 20,053
  • 6
  • 63
  • 70
the_critic
  • 12,720
  • 19
  • 67
  • 115
  • What is different about this log when you run locally? Find the difference and you will probably identify the problem. – Jim Garrison Oct 09 '13 at 23:27
  • @JimGarrison There is no authentication error locally... – the_critic Oct 10 '13 at 00:14
  • Post the same log from a local attempt. – Jim Garrison Oct 10 '13 at 02:02
  • @MartinE. There MUST be one of those challenges available when it works on the other machine. Does the log on that machine show which one it uses (Kerberos, Digest, etc)? Also take a look at the http header and see if it's passing anything different when it succeeds. – alexroussos Oct 10 '13 at 02:02
  • Is your Linux Amazon AMI server behind some kind of firewall you're not aware of? – LazyCubicleMonkey Oct 10 '13 at 02:11
  • 1
    @LazyCubicleMonkey Actually, I got it to work. I tried to pass the oAuth parameters in the console as program arguments, but it kind of misread these arguments (still do not know why...) and therefore the authentication was invalid of course. These parameters were originally passed as program arguments for testing purposes, so I guess I got rid of the problem :-) – the_critic Oct 10 '13 at 08:41

1 Answers1

0

It has to do with your computer clock sync. if using MAC on date and time prefernces select Set date and time automatically.. This solved the issue for me.

If on linux please follow the below link of installing "ntp"

https://vandannguyen.wordpress.com/2014/12/02/twitter-error-connecting-w-status-code-401-reason-authorization-required/

Santosh B
  • 51
  • 2