React-native-firebase: reauthenticateWithCredential makes app crashes [iOS + Android]

Created on 17 Jan 2018  路  1Comment  路  Source: invertase/react-native-firebase

When reauthenticateWithCredential method is called, app crashes on iOS and Android.

I would like to change user password. This is my code:

...
firebase.auth().currentUser.reauthenticateWithCredential(email, password).then(() => {
     return user.updatePassword(newPassword)
}).then(() => {
...

Xcode log says:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Either IDToken or accessToken must be supplied.'

On Android:
schermata 2018-01-17 alle 17 53 36

My environment:
"react": "16.2.0",
"react-native": "0.52.0",
"react-native-firebase": "^3.1.1",

Most helpful comment

reauthenticateWithCredential needs a credential, not the email and password:

const credential = firebase.auth.EmailAuthProvider.credential(email, password);
firebase.auth().currentUser.reauthenticateWithCredential(credential).then(() => {

});

>All comments

reauthenticateWithCredential needs a credential, not the email and password:

const credential = firebase.auth.EmailAuthProvider.credential(email, password);
firebase.auth().currentUser.reauthenticateWithCredential(credential).then(() => {

});
Was this page helpful?
0 / 5 - 0 ratings