Unable to compose tweets - Receiving error - 'Request failed: unauthorized (401)'

ios
objective-c

#1

Hi,

I’m trying to compose tweets from my iOS app (Obj-C). I’m able to Login without any issues but I hit a road block when I try to compose tweets from my app. I’m getting the below error.

And yes, I have double checked the TwitterKit initialization in AppDelegate.m and added callback URL in my App in Twitter and also verified the entries in info.plist file (as in https://dev.twitter.com/twitterkit/ios/installation).

Did encounter error sending Tweet: Error Domain=TWTRNetworkingErrorDomain Code=-1011 “Request failed: unauthorized (401)” UserInfo={NSLocalizedFailureReason=, TWTRNetworkingStatusCode=401, NSErrorFailingURLKey=https://api.twitter.com/1.1/statuses/update.json, NSLocalizedDescription=Request failed: unauthorized (401)}

Please help!


#2

Hi there,
This issue also occurred in my project regardless of iOS version (tested on iOS 10, iOS 11)

The weird thing is this only happens to my customer’s account.
I tried with another 2 accounts, composing tweet works.

Below message is also shown in console log.

CredStore - performQuery - Error copying matching creds.  Error=-25300, query={
    class = inet;
    "m_Limit" = "m_LimitAll";
    ptcl = htps;
    "r_Attributes" = 1;
    sdmn = "https://api.twitter.com";
    srvr = "api.twitter.com";
    sync = syna;
}

I’m using TwitterKit v3.1.1 (Objective-C)

I really appreciate if there is any update about this.
Many thanks.


#3

It turns out it is problem with the customer’s account.

This seems that the app permission was set to Read-only.
But after a careful check, it was still Read & Write.
Finally regenerating the consumer key and secret made it work.


#4