i am trying to use the firebase user authentication and management to register, login, etc a user
but i have issues getting $getAuth()
or $createUser()
, they come in as undefined is not a function
, also $getCurrentUser()
seems to be missing
example:
angular.module('starter.services', [])
.factory('Auth', function ($q, $firebase, FBURL, $location, $rootScope, localStorageService) {
var ref = new Firebase(FBURL);
var auth = $firebase(ref);
console.log(auth.$getAuth()); //undefined is not a function
any ideas?
i am using AngularFire 0.9.0
, Firebase v2.0.4
, AngularJS v1.3.3
.
You seem to have some copy/paste/modify errors from the examples. $getAuth
is an AngularFire method, so it is not defined on a regulare Firebase JavaScript ref.
The simplest example I could quickly code up:
angular.module('app', ['firebase'])
.constant('FBURL', "https://your.firebaseio.com")
.factory("Auth", function($firebaseAuth, FBURL) {
var ref = new Firebase(FBURL);
return $firebaseAuth(ref);
})
.controller('MainCtrl', function ($scope, Auth) {
$scope.auth = Auth;
console.log(Auth.$getAuth());
})
;
Note that this will only log something meaningful if the user is logged in, otherwise it will log null
.