简体   繁体   中英

iOS Upgrading Firebase Auth

I am trying to migrate my data to the new version of Firebase and I am having some trouble with creating a user and logging them in (Email and Password).

Here is my part of old data. After creating a user, I log them in and capture the password as authData.provider!. This would store the password as just "Password" in my data structure. I am struggling with finding the new "authData.provider! in the the Firebase SDK.

ref.authUser(email, password: password, withCompletionBlock: { err, authData in

     let user = ["provider": authData.provider!, "email": email!, "username": username!]

Here is the new code I am replacing the above code with.

FIRAuth.auth()?.signInWithEmail(email!, password: password!) { (user, error) in

     let userLocal = ["provider": user!.providerData.description, "email": email!, "username": username!]

I found that authData.provider! != user!.providerData.description, and I can't find what authData.provider! is in the new SDK. Thank you for any suggestions!

Think I figured it out. used user!.providerID

let userLocal = ["provider": user!.providerID, "email": email!, "username": username!]

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