Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lapinek/89c6afd04c3933d6edf9a5ea24bfb957 to your computer and use it in GitHub Desktop.
Save lapinek/89c6afd04c3933d6edf9a5ea24bfb957 to your computer and use it in GitHub Desktop.
// ViewController.swift
// . . .
// MARK: Authorization methods
extension ViewController {
// . . .
func authorizeWithWebView(
configuration: OIDServiceConfiguration,
clientId: String,
redirectionUri: String,
scopes: [String] = [OIDScopeOpenID, OIDScopeProfile],
completion: @escaping (OIDAuthState?, Error?) -> Void
) {
// . . .
// Configuring the web view for JavaScript interactions.
let userContentController = WKUserContentController()
userContentController.add(self, name: "callback")
let configuration = WKWebViewConfiguration()
configuration.userContentController = userContentController
// Providing the web view class with initial parameters.
webViewController = WebViewController.init(
appGroup: appGroup,
appGroupCookies: appGroupCookies,
webViewFrame: view.bounds,
webViewConfiguration: configuration
)
// . . .
}
}
// . . .
}
// . . .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment