When developing an app in iOS that includes a
WKWebView component, a few additional steps are needed to ensure that the social login functions properly.
WKWebView component provides a subset of the functionality of the iOS
Safari browser, and provides a means to navigate to and control a web page. The
WKWebView's behavior deviates from regular browsers in the way that it manages
WKWebView component's management of popup windows is not the same as typical browsers such that a popup window is loaded in place of the current document. Rather than opening a popup in a separate window, the
WKWebView replaces the current page with the popup content, while not retaining an 'opener' link to the original page.
Viafoura's social login process requires a popup window to manage the authentication process with the appropriate social network. Once the social network has authorized a user's credentials, the popup window is closed, and the originating site will now be logged into Viafoura.
This document and supporting repository will provide you with clean steps on implementation.
Please review iOS-Webview-sample/iOS-Webview-sample/ViewController.swift
for a sample implementation which enables Viafoura social login.
WKWebView's controller must:
- Implement the
webViewDidCloseto allow popups to close
func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures)and open a new webview as a subview for URLs at
The implementation of Viafoura's tools in a
WKWebViewcan be difficult.
Contact our support team at [email protected] for more information and assistance.
Updated 7 months ago