HTTP request failed, Status: 401



Hi, I’m using TwitterKit in my app for aut and Twitter requests. But I have one issue there.
When i try to add tweet to my favorites or make a retweet i always have error (calls like statuses/home_timeline works good) HTTP request failed, Status: 401

Maybe I made a mistake in authorization part?
This is my code for authorization.:

 TwitterAuthClient mTwitterClient = new TwitterAuthClient();

    mTwitterClient.authorize(AccountsActivity.this, new Callback<TwitterSession>() {
        public void success(Result<TwitterSession> result) {
            Log.d("twirrer", "login_succes");
            TwitterSession session = Twitter.getSessionManager().getActiveSession();
            TwitterAuthToken authToken = session.getAuthToken();
            final String token = authToken.token;


        public void failure(TwitterException exception) {
            Log.d("twirrer", "login_err " + exception.getMessage());

 private void getUserProfile(final String userToken) {
    Call<User> user = Twitter.getApiClient().getAccountService().verifyCredentials(true, true);
    user.enqueue(new Callback<User>() {
        public void success(Result<User> result) {
            Log.d("twirrer", "tw_profile_success");

        public void failure(TwitterException exception) {
            Log.d("twirrer", "tw_profile_err");


A 401 generally indicates that the user isn’t authorized to Favorite or Retweet on behalf of the user that’s logged in. Are you seeing a login success before trying to do the post?

Getting a profile wouldn’t require the same explicit user authentication.



At first i call authorize() function of TwitterAuthClient. I receive “onSuccess” result, with auth token like this: 741593337912786944-kdhMjOAR0gbgIEZgtjyvRsM4trZd7ZY.

Then I call verify_credentials Api and there I have onSuccess too.

If i’m not authorized I had to get an error 401 when I call verify_credentials?


Sorry for worry, im resolved my problem now. It is similar to my dev acc was wrong configured. Thank you for your help and answers so much.


Glad to hear you’re all set and happy coding.