If you register a URI scheme for your app, you could have have a link on a page which takes you back to your app. At that point you'll be in
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
of your AppDelegate and you can do whatever you wish.
“Because since Safari View Controller has access to a user’s
credentials, synced across all of their devices with iCloud Keychain,
logging in is going to be a breeze.[…] It takes two steps. The first
is where you would’ve used your own in-app browser, just present an
instance of SFSafariViewController.
And once the user is finished logging in and the third-party web
service redirects back to your app with the custom URL scheme that you
fed it, you can accept that in your AppDelegate‘s handleOpenURL
method.
From there you can inspect the response and dismiss the instance of
SFSafariViewController because you know that the authentication is
done.
That’s it. Two steps.”
Source: http://asciiwwdc.com/2015/sessions/504#t=1558.026
Please note the handleOpenURL
method is deprecated in favor of application:openURL:options:
.