iOS - TwitterKit Login -> Error Code 135 : Timestamp out of bounds

restapi
ios
apps.twitter.com
signin

#1

Device Setting:
Default : Gregorian (Not Problem)
Another Calendar : Buddhist, Japanese

Method:

Error:

I found this error with device setting calendar to Buddhist or Japanese. (Not found with Gregorian)

Test Case:

First time to open application and call API with #Method1 (equal first time to call API) I get response with success.
Next I call #Method2, I found error code 135. I can solved by add parameter (“oauth_timestamp” : correct timestamp).

Second time to call #Method1 after logout or cancel from login page, I found error code 135.

I think #Method1 and #Method2 have get device timestamp for send to check with server.
That maybe solved issue by change to correct timestamp but #Method1 can’t add parameter for solve same as #Method2

How to fixed this issue?


IOS- Twitter API error : Timestamp out of bound
iOS Twitterkit Login Error - Timestamp out of bounds
#2

Hey @SLS,

Just to be sure I’m following - this only happens when using Japanese or Buddhist calendars and only on the second call to Method 1?

-Mike


#3

Yes, As much as I found and check it.
Thank you for following up on this.


#4

Thanks for confirming, I’ve flagged this internally, but in the meantime, would use the workaround that you mentioned earlier.


#5

@bonnell ,
Have you had solution for this issue yet?
I just update TwitterKit to 2.8.1 and found this issue


#6

Hey @ajangzP,

I’m no longer working on Twitter Kit specific areas due to Google’s acquisition of Fabric. I’m sure someone else can provide more information or if you have additional context or information to share, please share that.


#7

Thank you for your replying @bonnell :slight_smile:
My context information is same above.

Error code 135 Timestamp out of bounds when call twitter login , only when setting calendar to Buddhist or Japanese.

I am very appreciated that if you could mention someone else who can help me through this issue


#8

Any update on this? I am having the same issue with Buddhist calendar.

Edit:

I tried changing the ‘Authorization’ key of request header (which holds oauth_timestamp) manually, but still received 401.

OAuth oauth_signature="XXX", 
oauth_nonce="XXX", 
oauth_timestamp="18446744058071689377", 
oauth_consumer_key="XXX", 
oauth_token="XXX", 
oauth_version="1.0", 
oauth_signature_method="HMAC-SHA1"

to

OAuth oauth_signature="XXX", 
oauth_nonce="XXX", 
oauth_timestamp="1496812961", 
oauth_consumer_key="XXX", 
oauth_token="XXX", 
oauth_version="1.0", 
oauth_signature_method="HMAC-SHA1"

Edit2:

Plus, apple documentation says you should not modify Authorization header. So…

Edit3:

Passing it as a parameter seems to work, but I’m not sure this works 100% of the time.

NSString *timestamp = [NSString stringWithFormat:@"%d",(int)[[NSDate date] timeIntervalSince1970]];
TWTRAPIClient *client = [TWTRAPIClient clientWithCurrentUser];
NSURLRequest *request = [client URLRequestWithMethod:@"GET"
                                   URL:@"https://api.twitter.com/1.1/account/verify_credentials.json"
                            parameters:@{@"include_email":@"true",
                                         @"skip_status":@"true",
                                         @"oauth_timestamp":timestamp}
                                 error:nil];

For the OP, get the timestamp as an integer instead of float. Seems to be working fine till now.


#9

The solution I mentioned above fixes the issue with login. But it does not fix the problem with sending a tweet using TWTRComposerViewController.

TWTRComposerViewController *composer = [[TWTRComposerViewController alloc] initWithInitialText:@"Some Text" image:nil videoURL:nil];
composer.delegate = self;
[self presentViewController:composer animated:YES completion:nil];

This always results in Failed to send alert. Any workaround for this one?


#10

Same


#11

Xcode 9.2

PROJECT > Info > Localizations
Add Japanese

I do not know what the reason is, but the Japanese calendar can be used.
[Google translation]