javascript - Firebase: During testing I get "undefined is not a function" -
this used code:
var cred = firebase.auth().emailauthprovider($scope.data.mail, $scope.data.pwd); firebase.auth().signinwithcredential(cred) .then(function()
during testing, following error:
typeerror: undefined not function (evaluating 'firebase.auth().emailauthprovider($scope.data.mail, $scope.data.pwd)')
so what's wrong code? how can fix problem?
to log user in via email/pass call signinwithemailandpassword
method.
firebase.auth().signinwithemailandpassword(email, password).catch(function(error) { // handle errors here. var errorcode = error.code; var errormessage = error.message; // ... });
then can listen realtime auth event:
firebase.auth().onauthstatechanged(function(user) { if (user !== null) { console.log('logged in!'); } });
Comments
Post a Comment