0

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("[email protected]", 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 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

So how do I make use of changePasswordForUser? Which seems to take an email, old password and new password as parameters?
changePasswordForUser() is for the user to change their password in your app. If the user has forgotten their password, you need to use resetPasswordForUser(), which sends a password reset email. There currently is no API to change/reset the password without either knowing the current password or sending an email.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.