Firebase / Swift 2 - 如何获取经过验证的用户密码和电子邮件 [英] Firebase/Swift 2 - How to get an authenticated users password and email

查看:172
本文介绍了Firebase / Swift 2 - 如何获取经过验证的用户密码和电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



以下是Firebases示例:

  let ref = Firebase(url:https://< YOUR-FIREBASE-APP> .firebaseio.com)
ref.changePasswordForUser(bobtony @ example.com,from Old:correcthorsebatterystaple,
toNew:batteryhorsestaplecorrect,withCompletionBlock:{error in

if error!= nil {
//有一个处理请求的错误
} else {
//密码已成功更改
}
})

如何访问经过验证的用户电子邮件&密码,以便将这些值传递给这个函数,而不是当前的模拟数据?

我没有兴趣在传递重置电子邮件中发送临时密码。

p>

我以为可以通过如下方式访问这些值:

  let ref = Firebase(url:firebaseURL)

ref.authData.providerData.someValueHere

但我一直无法弄清楚。



如何从当前认证的用户访问这些值?

解决方案


如何访问经过验证的用户电子邮件&密码

Firebase不存储用户的密码。而是存储用户密码的散列。这意味着Firebase没有返回用户密码的API。


I'm trying to setup a password reset within an app using swift 2 and Firebase.

Following Firebases example:

let ref = Firebase(url: "https://<YOUR-FIREBASE-APP>.firebaseio.com")
ref.changePasswordForUser("bobtony@example.com", fromOld: "correcthorsebatterystaple",
toNew: "batteryhorsestaplecorrect", withCompletionBlock: { error in

    if error != nil {
        // There was an error processing the request
    } else {
        // Password changed successfully
    }
})

How can I access an authenticated users email & password in order to pass those values to this function instead of the current mock data?

I'm not interested in sending a temporary password in a pass reset email.

I was thinking that I'd be able to access these values by something like:

let ref = Firebase(url: firebaseURL)

ref.authData.providerData.someValueHere

But I haven't been able to figure it out.

How can I access these values from the currently authenticated user?

解决方案

How can I access an authenticated users email & password

Firebase does not store the user's password. Instead it stores a hash of the user's password. That means that there is no API from Firebase that returns a user's password.

这篇关于Firebase / Swift 2 - 如何获取经过验证的用户密码和电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆