javascript - angularJs + firebase $createUser , new SDK erorr -


i try create user , angular

myapp.controller('loginctrl',['$scope','$firebaseauth','config',function($scope,$firebaseauth,config){  console.info('[app-info] ~ loginctrl start')  var ref = new firebase('https://myauth-tadmit.firebaseio.com/'); var auth = $firebaseauth(ref);  $scope.register =  function(){         auth.$createuser({         email: $scope.user.email,         password: $scope.user.password     }).then(function(reguser){         console.log('regcomplete user:' )     }).catch(function(error){         console.log(error.message)     }); }  }]); 

and when call register() function , console erorr:

projects created @ console.firebase.google.com must use new firebase authentication sdks available firebase.google.com/docs/auth/ 

i use angular 1.5.8 +

<script src="https://cdn.firebase.com/js/client/2.2.4/firebase.js"></script> <script src="https://cdn.firebase.com/libs/angularfire/1.2.0/angularfire.min.js"></script>    

what i'm wrong ?!

firebase sdk 3.

controller:

myapp.controller('loginctrl',['$scope','fbauthservice',function($scope,fbauthservice){  console.info('[app-info] ~ loginctrl start')  $scope.register = function(email,password,info){      fbauthservice.register(email,password,info); }   }]); 

then service:

    myapp.service('fbauthservice',['$firebaseauth','$location',function($firebaseauth,$location){  var config = {     apikey: "",     authdomain: "",     databaseurl: "",     storagebucket: "", };  firebase.initializeapp(config);   // authentication    var authobj = $firebaseauth(); var self = {};  self.register = function(email,password,info){     authobj.$createuserwithemailandpassword(         email,         password     ).then(function(newuser){          //add info signup users => newuser.id => info(object)         var ref = firebase.database().ref().child('users').child(newuser.uid);         ref.set({ firstname: info.firstname, lastname: info.lastname, uid: newuser.uid });         $location.path('/login')     }).catch(function(error){        console.log(error.message)     }); }  return self; }]); 

to config value , open firebase app overview: https://console.firebase.google.com/project/your-appname/overview

then click on "add firebase web app"

work fine!


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -