Firebase/Swift 2 - How to get an authenticated use

2019-03-06 01:14发布

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条回答
Juvenile、少年°
2楼-- · 2019-03-06 01:30

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.

查看更多
登录 后发表回答