Passwordless single sign on using SFSafariViewController in swift

0

I integrate with safriService (SFSafariViewController) to log in through a single sign-on password, the problem was the first time I log in using SFSafariViewController but the authentication follow not complete the first time so the safari browser still appear & can not direct into my app after authentication follow to become a success, another behavior is when I login again the authentication follow work fine & get the token then directed into my app fine so the main problem is the first time I login SFSafariViewController does not catch the user auth

if let url = URL(string: "url") { let safariVC = SFSafariViewController(url: url) safariVC.delegate = self

    safariVC.dismissButtonStyle = .done
    present(safariVC, animated: true, completion: nil)
}

extension DouWebViewVC: SFSafariViewControllerDelegate {

func safariViewController(_ controller: SFSafariViewController, didCompleteInitialLoad didLoadSuccessfully: Bool) { if didLoadSuccessfully { print("didLoadSuccessfully") // Do something with the URL here } }

//initialLoadDidRedirectTo func safariViewController(_ controller: SFSafariViewController, initialLoadDidRedirectTo requestUrl: URL) { let absoluteUrl = requestUrl.absoluteString print("requestUrl(requestUrl)") }

func safariViewControllerDidFinish(_ controller: SFSafariViewController) { print("safariViewControllerDidFinish") } }

Passwordless single sign on using SFSafariViewController in swift
 
 
Q