Changing User Email and Password with Swift and Firebase

戏子无情 提交于 2019-12-06 16:06:34

Accarding to Firebase API making some confusion. after i seen the API https://www.firebase.com/docs/ios/api/#firebase_changeEmailForUserpasswordtoNewEmailwithCompletionBlock There is clearly said:

So for the update Email For user this is not a part a update profile. So as per following you can change your email address:

 ref.changeEmailForUser("OldEmailthatYouuserForLogin", password: "correctpassword",
            toNewEmail: "newEmail", withCompletionBlock: { error in
                if error != nil {

                     print("There was an error processing the request")
                    // There was an error processing the request
                } else {

                    print("Email changed successfully")

                    // Email changed successfully
                }
        })

// Dont use edited email for the old email and edited password for the password make sure you are using your actually email and password

Mariah,

The problem is your entered email and password details. You are showing the path for your email and password but instead you should enter what calls them such as. instead of ""users/(self.ref.authData.uid)/email" you should provide it as ref.authData.providerData["email"]as? NSString as? String

for password you need to edit your Firebase rules so user can have access to his own password.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!