简体   繁体   中英

Passwordless Email Auth Firebase, Dynamic Links (FDL)

I'm trying to setup password-less email authentication through firebase for my iOS app. I'm using the method send signInLink which require actionCodeSettings and in turn a url. I've discovered that this url has to be a dynamic link created on 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" .

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

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" .

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 ).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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