Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1898574
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:46:55+00:00 2026-05-17T06:46:55+00:00

Anybody can please help in Android + Twitter Integration using OAuth. I already worked

  • 0

Anybody can please help in Android + Twitter Integration using OAuth.

I already worked on http://github.com/brione/Brion-Learns-OAuth and getting the error listed below, when I am posting status update…

WARN/System.err(190): org.apache.http.client.HttpResponseException: Unauthorized
WARN/System.err(190):     at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:71)
WARN/System.err(190):     at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:59)
WARN/System.err(190):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:657)
WARN/System.err(190):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:627)
WARN/System.err(190):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:616)
WARN/System.err(190):     at com.test.twitter.BLOA$PostTask.doInBackground(BLOA.java:343)
WARN/System.err(190):     at com.test.twitter.BLOA$PostTask.doInBackground(BLOA.java:1)
WARN/System.err(190):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
WARN/System.err(190):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:256)
WARN/System.err(190):     at java.util.concurrent.FutureTask.run(FutureTask.java:122)
WARN/System.err(190):     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:648)
WARN/System.err(190):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:673)
WARN/System.err(190):     at java.lang.Thread.run(Thread.java:1060)

I succeed with OAuth Authentication and getting user_secret and user_token and stored in preferences…

So the issue is with http posting using OAuth header…

and My Http Post Method is as :

private class PostTask extends AsyncTask<String, Void, JSONObject> {

  ProgressDialog postDialog;

  @Override
  protected void onPreExecute() {
   postDialog = ProgressDialog.show(BLOA.this,
     getText(R.string.tweet_progress_title),
     getText(R.string.tweet_progress_text), true, // indeterminate
                 // duration
     false); // not cancel-able
  }

  @Override
  protected JSONObject doInBackground(String... params) {

   JSONObject jso = null;
   try {
    HttpPost post = new HttpPost(
      "http://twitter.com/statuses/update.json");
    LinkedList<BasicNameValuePair> out = new LinkedList<BasicNameValuePair>();
    out.add(new BasicNameValuePair("status", params[0]));
    post.setEntity(new UrlEncodedFormEntity(out, HTTP.UTF_8));
    post.setParams(getParams());
    // sign the request to authenticate
    mConsumer.sign(post);
    String response = mClient.execute(post,
      new BasicResponseHandler());
    jso = new JSONObject(response);
   } catch (UnsupportedEncodingException e) {
    e.printStackTrace();
   } catch (OAuthMessageSignerException e) {
    e.printStackTrace();
   } catch (OAuthExpectationFailedException e) {
    e.printStackTrace();
   } catch (OAuthCommunicationException e) {
    e.printStackTrace();
   } catch (ClientProtocolException e) {
    e.printStackTrace();
   } catch (IOException e) {
    e.printStackTrace();
   } catch (JSONException e) {
    e.printStackTrace();
   } finally {

   }
   return jso;
  }

  // This is in the UI thread, so we can mess with the UI
  protected void onPostExecute(JSONObject jso) {
   postDialog.dismiss();
   if (jso != null) { // authorization succeeded, the json object
     // contains the user information
    mEditor.setText("");
    mLast.setText(getCurrentTweet(jso));
   } else {
    mLast.setText(getText(R.string.tweet_error));
   }
  }
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T06:46:55+00:00Added an answer on May 17, 2026 at 6:46 am

    Please describe what Client/Consumer/Provider you are using, they must be DefaultHttpClient/CommonsHttpOAuthConsumer/CommonsHttpOAuthProvider to work properly for sure.

    Ensure you call consumer.setTokenWithSecret(oToken, oTokenSecret); before calling this code.

    Also, is post.getParams().setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, false); exists in your post params?

    What’s the reason for using empty BasicResponseHandler, it handles nothing and it can be omitted in execute call, I suppose.

    And, may be a dumb question, may be you are overwriting params when calling setParams(...) after setEntity(...)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anybody please help me with a link or document to run jbpm-5.2 on
Can anybody please help me with this as I have no idea why public
Can anybody help me on how to use speex or jspeex in android? I
Can anybody please help me with this particular query? I'm having ORA-00979 when trying
I have been given the 3 functions below. Can anybody please help me to
can anybody please provide me some code that could help me. actually i am
hi i am new to android. can anybody help me to solve this. i
Can anybody please help me creating the same horizontal accordian menu with all the
Can anybody please help me make this work? Donor-enumerate() doesn't work, gcc gives no
Can anybody please help me by providing different ways of printing other than System.out.println()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.