Forgerock SDK biometrics authentication in WKWebView

49 views Asked by At

I was using the Forgerock SDK for passwordless biometric authentication. We have done our server setup, and the URL is as follows: https://sandbox.example.com/kauth/XUI/?realm=test-sandbox&service=biometricAuth

class WebViewController: UIViewController {
    // MARK: - Propertie's
    @IBOutlet weak var loginWebView: WKWebView!
    // MARK: - View Life cycles
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        self.loginWebView.navigationDelegate = self
        self.loadURL()            
    }
    
    func loadURL() {
        let url = URL(string: "https://sandbox.example.com/kauth/XUI/?realm=test-sandbox&service=biometricAuth")!
        loginWebView.load(URLRequest(url: url))
        loginWebView.allowsBackForwardNavigationGestures = true
    }
}
extension WebViewController: WKNavigationDelegate {
func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
        let cred = URLCredential(trust: challenge.protectionSpace.serverTrust!)
        completionHandler(.useCredential, cred)
    }
}

I had WKWebView open and loaded the URL. When I finished logging in, I started getting callbacks saying things like, "Device registered," "Not register like that," and "Is it possible to do in webview or will it work only in native?"

SDK Reference Link

0

There are 0 answers