Firebase重置密码Swift

Tyg*_*yge 14 passwords reset ios firebase swift

我想知道你们是否可以告诉我如何在Swift中设置重置密码,我目前正在使用Firebase作为我的后端服务.我只需要代码.

Jay*_*Jay 68

答案在API文档中:

-sendPasswordResetWithEmail:completion:

为给定的电子邮件地址启动密码重置.

请参阅FIRAuthErrors以获取所有API方法通用的错误代码列表.

在Swift 3.x和Firebase 3.x中,它看起来像这样:

FIRAuth.auth()?.sendPasswordReset(withEmail: "email@email") { error in
    // Your code here
}
Run Code Online (Sandbox Code Playgroud)

编辑:

Firebase 4将Firebase功能更改为与Swift中的命名约定更加一致.

Auth.auth().sendPasswordReset(withEmail: "email@email") { error in
    // Your code here
}
Run Code Online (Sandbox Code Playgroud)

  • @Jay 像你这样的人让互联网变得更美好......而且谷歌搜索更容易!我很感激!+1 (2认同)