Authentication error 401 code 32 when verifying Twitter Digits credentials on iOS


#1

I am using Twitter digits in my app. When the user signs into Digits, I save the auth token, auth token secret, userId, and phone number in the user’s keychain. On every launch, I make a call to account/verify_credentials endpoint to verify the user’s credentials. After the user signs in, every time I try to authenticate the user’s credentials, I get a 401 error, with a 32 error code. Here is the response I receive:

<NSHTTPURLResponse: 0x17ec18f0> { URL: https://api.twitter.com/1.1/account/verify_credentials.json } { status     code: 401, headers {
    "Content-Encoding" = deflate;
    "Content-Length" = 76;
    "Content-Type" = "application/json;charset=utf-8";
    Date = "Sat, 27 Dec 2014 22:24:34 UTC";
    Server = "tsa_a";
   "Strict-Transport-Security" = "max-age=631138519";
    "x-connection-hash" = ae27b1aa0d5e35c86ae3494d3d1bf5ec;
    "x-response-time" = 7;
} }

Here is my code for sending the request:

    NSString *authToken = [SSKeychain passwordForService:kDigitsAuthToken account:kRLTwitterAuth];
NSString *authTokenSecret = [SSKeychain passwordForService:kDigitsAuthTokenSecret account:kRLTwitterAuth];
NSString *userId = [SSKeychain passwordForService:kDigitsUserId account:kRLTwitterAuth];
NSString *phoneNumber = [SSKeychain passwordForService:kDigitsPhoneNumber account:kRLTwitterAuth];
DGTSession *newSession = [[DGTSession alloc] initWithAuthToken:authToken authTokenSecret:authTokenSecret userID:userId phoneNumber:phoneNumber];

TWTROAuthSigning *oauthSigning = [[TWTROAuthSigning alloc] initWithAuthConfig:[Twitter sharedInstance].authConfig authSession:newSession];
NSDictionary *authHeaders = [oauthSigning OAuthEchoHeadersToVerifyCredentials];
NSString *requestURLString = authHeaders[TWTROAuthEchoRequestURLStringKey];
NSString *authorizationHeader = authHeaders[TWTROAuthEchoAuthorizationHeaderKey];

NSMutableURLRequest *request = [self requestForURL:requestURLString];
[request setValue:authorizationHeader forHTTPHeaderField:@"Authorization"];

Am I doing something wrong? This was working, but it stopped for some reason.


#2

I’m seeing code 32 errors on certain users as well. Most verification of credentials are OK but some users consistently generate echo headers that fail verification. I have a few examples saved if anyone at twitter wants to take a look.


#3

Twitter please your help! i get the same with the 215 error code :\


#4

Hey Nick, I have the exact same problem. I get the code 32 error with only some users. Were you able to solve this?


#5

I haven’t seen this in a while. It doesn’t appear to be happening for me anymore.


#6

Damn, I’ve been getting it for a couple of weeks now. I’m not sure there’s a pattern, but it happens with users that are not very active. I can’t find many answers to this specific problem either.