Swift3 iOS -Firebase FIREmailPasswordAuthProvider not working

I just upgraded my Firebase Cocoapods from 3.15.0 to 4.0.4 and FirebaseAuth Cocoapods from 3.1.1 to 4.0.0.

I use email and password to authenticate users. When the user changes his email address, I used this method below and everything works fine:

FIREmailPasswordAuthProviderID.credential(withEmail: emailTextField.text!, password: passwordTextField.text!)

Now that I have updated, I get an error

'String' value does not have member credentials'

I looked through the docs and said I used the following method:

enter image description here

The problem is that I get the exact same error:

FIREmailAuthProviderID.credential(withEmail: emailTextField.text!, password: passwordTextField.text!)

'String' value does not have member credentials'

My source code is below

import Firebase
import FirebaseAuth

let user: User?

let credential = FIREmailPasswordAuthProviderID.credential(withEmail: emailTextField.text!, password: passwordTextField.text!)

        if let user = user{
            user.reauthenticate(with: credential, completion: {
                (error) in
                if error != nil{
                    //...do something
                    return
                }
                //...do something else
            })
        }

What am I doing wrong?

+4
3

FIREmailAuthProviderID - , auth ( EmailAuthProviderID FB 4). , .

Firebase 4

( )

EmailAuthProvider.credential( : , : String) → AuthCredential

20171014 : .

+8

I think you need to use EmailAuthProviderID instead of FIREmailAuthProviderID. Firebase 4.0 no longer uses the FIR suffix.

Hope it helps you :)

0
source

Source: https://habr.com/ru/post/1681542/


All Articles