Calling Twitter's logIn(completion:) method while being on insecure SSL connection

ios
fabric

#1

Greetings!

I was testing Twitter.sharedInstance().logIn(completion: completionHandler) method while using insecure SSL connection (was debugging with mimtproxy) and noticed that completionHandler doesn’t get called at all in this case - even with an error. Here’s the log immediately after running this method in this case:

2017-03-07 15:15:09.921938+0300 MyApp[965:468398] [TwitterKit] did encounter error with message "Unable to authenticate using the system account.": Error Domain=TWTRLogInErrorDomain Code=2 "User allowed permission to system accounts but there were none set up." UserInfo={NSLocalizedDescription=User allowed permission to system accounts but there were none set up.}
2017-03-07 15:15:09.923162+0300 MyApp[965:468398] [TwitterKit] No matching scheme found.
2017-03-07 15:15:10.324068+0300 MyApp[965:470149] [TWTRURLSessionDelegate] Cancelling API request, SSL certificate is invalid.
2017-03-07 15:15:10.325626+0300 MyApp[965:468398] [TwitterKit] did encounter error with message "Error obtaining user auth token.": Error Domain=TWTRLogInErrorDomain Code=-1 "" UserInfo={NSLocalizedDescription=}
2017-03-07 15:15:14.827325+0300 MyApp[965:469996] [TWTRURLSessionDelegate] Cancelling API request, SSL certificate is invalid.
2017-03-07 15:16:15.265328+0300 MyApp[965:470290] [TWTRURLSessionDelegate] Cancelling API request, SSL certificate is invalid.
2017-03-07 15:17:15.972499+0300 MyApp[965:470293] [TWTRURLSessionDelegate] Cancelling API request, SSL certificate is invalid.
2017-03-07 15:18:16.358134+0300 MyApp[965:470861] [TWTRURLSessionDelegate] Cancelling API request, SSL certificate is invalid.
2017-03-07 15:19:16.857606+0300 MyApp[965:470862] [TWTRURLSessionDelegate] Cancelling API request, SSL certificate is invalid.

Is there a way to catch such errors to properly alert user?

I’m using the latest Fabric, TwitterCore, TwitterKit pod versions in my project.


#2

That’s a good catch. We should call the completion block with a real error message for the developer to use as they wish.


#3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.