Firebase/Swift 2 - How to get an authenticated users password and email

给你一囗甜甜゛ 提交于 2019-12-20 06:37:03

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/36054579/firebase-swift-2-how-to-get-an-authenticated-users-password-and-email

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