From 26e82c589e41dd3aae185320658b9ed6a3ac39de Mon Sep 17 00:00:00 2001 From: Harel M Date: Sun, 20 Mar 2022 10:59:14 +0200 Subject: [PATCH] Fixes iOS crash Co-Authored-By: Manuele Sarfatti --- src/ios/OAuthPlugin.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ios/OAuthPlugin.swift b/src/ios/OAuthPlugin.swift index 13a25a5..a0f1a25 100644 --- a/src/ios/OAuthPlugin.swift +++ b/src/ios/OAuthPlugin.swift @@ -32,7 +32,9 @@ class ASWebAuthenticationSessionOAuthSessionProvider : OAuthSessionProvider { var delegate : AnyObject? required init(_ endpoint : URL, callbackScheme : String) { - self.aswas = ASWebAuthenticationSession(url: endpoint, callbackURLScheme: callbackScheme, completionHandler: { (callBack:URL?, error:Error?) in + let url: URL = URL(string: callbackScheme)! + let callbackURLScheme: String = url.scheme ?? callbackScheme + self.aswas = ASWebAuthenticationSession(url: endpoint, callbackURLScheme: callbackURLScheme, completionHandler: { (callBack:URL?, error:Error?) in if let incomingUrl = callBack { NotificationCenter.default.post(name: NSNotification.Name.CDVPluginHandleOpenURL, object: incomingUrl) }