Failed to get request token method POST must have a request body




I’m trying to implement twitter login in my android app.
I’ve followed the instructions ( ).

Everything is working fine if I have the twitter app installed but if I don’t when I tap on the login button I get the following exception:

06-02 11:22:23.531  24124-24124/it.quepasa W/dalvikvm: VFY: unable to resolve virtual method 39779: Lretrofit/client/OkClient;.openConnection (Lretrofit/client/Request;)Ljava/net/HttpURLConnection;
06-02 11:22:23.611  24124-24124/it.quepasa E/Twitter﹕ Failed to get request token method POST must have a request body.
        at retrofit.RestAdapter$RestHandler.invokeRequest(
        at retrofit.RestAdapter$RestHandler.access$100(
        at retrofit.RestAdapter$RestHandler$2.obtainResponse(
        at java.util.concurrent.ThreadPoolExecutor.runWorker(
        at java.util.concurrent.ThreadPoolExecutor$
        at retrofit.Platform$Android$2$
06-02 11:22:23.686  24124-24124/it.quepasa E/Twitter﹕ Authorization completed with an error Failed to get request token
        at retrofit.CallbackRunnable$
        at android.os.Handler.handleCallback(
        at android.os.Handler.dispatchMessage(
        at android.os.Looper.loop(
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(
        at dalvik.system.NativeStart.main(Native Method)

Here there is my code:


        android:value="XXXXXXXX" />

    TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
    Fabric.with(this, new Twitter(authConfig), new Crashlytics()); //I've tried without crashlytics, same problem. Crashlytics works..

    loginButton = (TwitterLoginButton) findViewById(;
    loginButton.setCallback(new Callback<TwitterSession>() {
        public void success(Result<TwitterSession> result) {
            Log.d(TAG, "Success");

        public void failure(TwitterException exception) {
            Log.d(TAG, "Failure");

    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        loginButton.onActivityResult(requestCode, resultCode, data);


What version of OkHttp and Twitter Kit are you using? What Android version and device are you seeing the problem via web view login?

Also, you might try starting Fabric in debug mode so it is more clear exactly which OAuth 1 protocol step is failing as we log it:

final Fabric fabric = new Fabric.Builder(this)
                .kits(new Twitter(authConfig))
                .logger(new DefaultLogger(Log.DEBUG))


Thank you for your hint but I’ve managed to solve the problem just a minute ago.

I was using retrofit with okhttp 2.4 in my project and there is breaking change in it. Reverting to okttp 2.3 solved the issue.

If the developers of okhttp / retrofit stick with this you should probably change twitter kit.

Best regards


closed #4