0

This is the code that is causing the problem. And below is the Logcat. I have printed the exception. I have checked the consumer and secret keys multiple times. Could anyone shed anymore light or how to get more details on this issue?

I should also mention that I have run this script on the emulator and a real phone, both bring back the same logcat

09-21 15:27:25.504: ERROR/HelloWorld(17680): 401:Authentication credentials (https://dev.twitter.com/docs/auth) were missing or incorrect. Ensure that you have set valid conumer key/secret, access token/secret, and the system clock in in sync.
09-21 15:27:25.504: ERROR/HelloWorld(17680): Failed to validate oauth signature and token
09-21 15:27:25.504: ERROR/HelloWorld(17680): Relevant discussions can be on the Internet at:
09-21 15:27:25.504: ERROR/HelloWorld(17680):     http://www.google.co.jp/search?q=10f5ada3 or
09-21 15:27:25.504: ERROR/HelloWorld(17680):     http://www.google.co.jp/search?q=dceba039
09-21 15:27:25.504: ERROR/HelloWorld(17680): TwitterException{exceptionCode=[10f5ada3-dceba039], statusCode=401, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=2.2.4}
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:185)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:65)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:102)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:121)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:104)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at twitter4j.TwitterBaseImpl.getOAuthRequestToken(TwitterBaseImpl.java:276)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at com.blundell.tut.ttt.TweetToTwitterActivity.loginNewUser(TweetToTwitterActivity.java:109)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at com.blundell.tut.ttt.TweetToTwitterActivity.buttonLogin(TweetToTwitterActivity.java:83)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at java.lang.reflect.Method.invokeNative(Native Method)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at java.lang.reflect.Method.invoke(Method.java:521)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at android.view.View$1.onClick(View.java:2077)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at android.view.View.performClick(View.java:2461)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at android.view.View$PerformClick.run(View.java:8890)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at android.os.Handler.handleCallback(Handler.java:587)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at android.os.Handler.dispatchMessage(Handler.java:92)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at android.os.Looper.loop(Looper.java:123)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at android.app.ActivityThread.main(ActivityThread.java:4627)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at java.lang.reflect.Method.invokeNative(Native Method)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at java.lang.reflect.Method.invoke(Method.java:521)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at dalvik.system.NativeStart.main(Native Method)
Somk
  • 11,869
  • 32
  • 97
  • 143

4 Answers4

3

Maybe, you`ve created a desktop application. Change type of your app on browser app. This is good tutorial http://www.androidhive.info/2012/09/android-twitter-oauth-connect-tutorial/

2
09-21 15:27:25.504: ERROR/HelloWorld(17680): 401:Authentication credentials (https://dev.twitter.com/docs/auth) were missing or incorrect. Ensure that you have set valid consumer key/secret, access token/secret

You have entered wrong Consumer Key or Secret Key from your Created Application in Twitter.

Ensure that you gave the two keys also ensure that it is correct.

For Further Reference Check this Integrating Twitter with Android

Venky
  • 11,049
  • 5
  • 49
  • 66
0

look at My application setting and Application type

Access:

  • Read only
  • Read and Write
  • Read, Write and Access direct messages

What type of access does your application need? Note: @Anywhere applications require read & write access.

Find out more about our Application Permission Model.

Default is read only please select read and write and again.

Marko
  • 20,385
  • 13
  • 48
  • 64
0

Well my device's date was incorrect. Seemed strange but, it did work. When the date was set correct it worked fine. You may show an alert asking the user to check the device current date and/or time.

Dhananjay M
  • 1,851
  • 22
  • 18