简体   繁体   English

无密码电子邮件身份验证Firebase,动态链接(FDL)

[英]Passwordless Email Auth Firebase, Dynamic Links (FDL)

I'm trying to setup password-less email authentication through firebase for my iOS app. 我正在尝试通过Firebase为我的iOS应用设置无密码的电子邮件身份验证。 I'm using the method send signInLink which require actionCodeSettings and in turn a url. 我使用的方法send signInLink需要actionCodeSettings ,然后是一个url。 I've discovered that this url has to be a dynamic link created on Firebase. 我发现该URL必须是在Firebase上创建的动态链接。 I've gone to the firebase console and white-listed a domain, but when I try to create the dynamic link on the console, I get "An error occurred when creating new dynamic link" . 我进入了Firebase控制台并将白名单列入白名单,但是当我尝试在控制台上创建动态链接时, 出现“在创建新的动态链接时发生错误”

I'm a little confused as to how I'm supposed to construct this dynamic link especially the deep link. 对于应该如何构造此动态链接(尤其是深层链接),我有些困惑。 I've been through Firebase's documentation, added a dummy App Store ID and App prefix (as I was told by Firebase support), but I can't seem to get a proper diagnosis behind this 我浏览过Firebase的文档,添加了虚拟的App Store ID和App前缀(如Firebase支持人员所告知),但在此背后我似乎无法得到正确的诊断

If I try sending the sign-in email there is no issue, but when I click on the link I get a 400 error saying "The requested URL was not found on this server" . 如果我尝试发送登录电子邮件,没有问题,但是当我单击链接时,出现400错误,提示“在此服务器上找不到所请求的URL”

Can anyone help me out with this? 谁能帮我这个忙吗?

actionCodeSettings.handleCodeInApp = true
    actionCodeSettings.url = URL(string: String(format: "my_dynamic_link", email.text!))
    actionCodeSettings.setIOSBundleID(Bundle.main.bundleIdentifier!)
    actionCodeSettings.setAndroidPackageName("", installIfNotAvailable: false, minimumVersion: "12")

Auth.auth().sendSignInLink(toEmail: email.text!, actionCodeSettings: actionCodeSettings, completion: { error in
        if error != nil {
            print("Link Error: " + (error?.localizedDescription)!)
            let castedError = error as NSError?
            let FBError = AuthErrorCode(rawValue: (castedError?.code)!)
            switch FBError {
            case .invalidEmail?:
                print("invalid email")
            case .emailAlreadyInUse?:
                print("in use")
            default:
                print("Create User Error: \(error!)")
            }
        }
        else {
            print ("No Error")
        }
    })

You could try following the troubleshooting steps mentioned in the Firecasts video "Getting started with Firebase Dynamic Links on iOS - Pt.1 (Firecasts)" at 7:54 ( https://youtu.be/KLBjAg6HvG0?t=474 ). 您可以尝试在7:54( https://youtu.be/KLBjAg6HvG0?t=474 )上执行Firecasts视频“ iOS上的Firebase动态链接入门-Pt.1(Firecasts)”中提到的故障排除步骤。

I was having the same issue and everything worked fine after: 我遇到了同样的问题,之后一切正常:

  1. deleting the app 删除应用
  2. restarting my phone 重新启动我的手机
  3. reinstalling the app 重新安装应用

Currently the bug radar ( http://www.openradar.me/radar?id=4999496467480576 ) is still open. 目前,错误雷达( http://www.openradar.me/radar?id=4999496467480576 )仍处于打开状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM