在Firebase电子邮件验证上重定向和绕过登录

时间:2019-01-11 19:17:11

标签: ios swift firebase redirect firebase-authentication

在重定向回应用程序时,在验证了电子邮件之后,我正在寻找一种自动登录用户以及用户必须重新输入其凭据的机制。

下面是我的appDelegate中的代码。

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
    if let incomingUrl = userActivity.webpageURL {
        let linkHandled = DynamicLinks.dynamicLinks().handleUniversalLink(incomingUrl) {
            [weak self] (dynamicLink, error) in
            guard let strongSelf = self else { return }
            if let dynamiclink = dynamicLink, let _ = dynamiclink.url {
                strongSelf.handleIncomingDynamicLink(dynamiclink)
            } //else check for errors
        }
        return linkHandled
    }
    return false
}

func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
    if let dynamicLink = DynamicLinks.dynamicLinks().dynamicLink(fromCustomSchemeURL: url) {
        print("Handling a link through the openURL method!")
        self.handleIncomingDynamicLink(dynamicLink)
        return true
    } 
    return false
}

func handleIncomingDynamicLink(_ dynamicLink: DynamicLink) {
        print("Your incoming link parameter is \(String(describing: dynamicLink.url))")        
}

0 个答案:

没有答案