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!');   } }); 

check docs here more on email login.

check api reference onauthstatechanged more info.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -