Search code examples
androidtwittertwitter-oauthtwitter4j

Twitter 4j change app keys causes OAuthException


My client switched his Twitter-app, so I've changed both keys (consumer & secret). But now it crashes on HttpOauthprovider.retrieveRequestToken(HttpOauthConsumer,callback), and I'm getting this error message before the app shows anything: "Failed to get request token: Communication with the service provider failed: https://api.twitter.com/oauth/request_token" From what I've read, it is usually happens what you try to make the the request on the UI-Thread, but this isn't the case. It's done with an AsyncTask in background thread.

The strange thing is that it worked well before changing the keys. I tried to change the callback url, and when I put an empty string there it let's me login but then shows this screen (which I don't know what it is).

enter image description here

Not sure if I even need a callback url, but the call back that is used in the code is "twitterapp://connect"

Again, my only goal is that the user will login to his twitter and then publish the twitter-app. Simple "share this app" feature.

Thanks.


Solution

  • Ok, It was very simple. The problem was cause by a mis-match between the Callback URL's in the Twitter app and the Android app.