I have an iOS application that authenticates with Uber API using OAuth2 in a UIWebView
. When upgrading to iOS 9, I run in to the issue of ATS blocking the https request for the login page. I then added an exception for the Uber login page, but then noticed the login page makes several other requests to Facebook, Amazon Web Services, and other websites, all getting blocked by ATS.
I don't want to have to maintain a list of exceptions for the the Uber login page, as Uber can easily change their page and my app won't have the correct exceptions. So I decided to give SFSafariViewController
a shot.
I am able to complete OAuth2 process with the SFSafariViewController
, the problem is there is some type of cookie being stored from Uber when the authentication completes. If I want to authenticate a different account and I bring up the SFSafariViewController
again, the cookie is picked up from the previous authentication, and there is no chance to authenticate a different account. I got around this with the UIWebView
by deleting the cookie through NSHTTPCookieStorage
, but I don't see a way to delete the cookie from SFSafariViewController
.