EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 444 forks source link

Cannot read property "PASSSWORD" of undefined #1535

Closed leocrawf closed 4 years ago

leocrawf commented 4 years ago

When I try to run a reauthenticate I am getting an error. Here is my code:

 const firebaseWebApi = require("nativescript-plugin-firebase/app");

 viewModel.reauthenticate = (email,currentPassword,newPassword) => {

    return firebaseWebApi.reauthenticate({
        type: firebaseWebApi.LoginType.PASSWORD, 
        passwordOptions: {
            email: email,
            password: currentPassword
        }
    }).then(
        function (result) {
            return viewModel.updatePassword(newPassword)
        },
        function (error) {
          return error
        }
    );
  }   

everything else works in the firebase plugin. I got the code from the reauthentication section of the docs here: https://github.com/eddyverbruggen/nativescript-plugin-firebase/blob/HEAD/docs/AUTHENTICATION.md

EddyVerbruggen commented 4 years ago

Looks like you're mixing usage of the native and web API's. Please carefully look at the examples here: https://github.com/EddyVerbruggen/nativescript-plugin-firebase/blob/e13d7d8fdcd1836f18f3d42ef5ff4823b1bea70c/docs/AUTHENTICATION.md#email-password-login

leocrawf commented 4 years ago

Thank you, I was able to fix the issue upon observing your response.