0
votes

I'm starting my first project with Firebase. I just try to make a simple authentification for a website, but when I try to login myself, I have this error :

Error: FirebaseSimpleLogin: Projects created at console.firebase.google.com must use the new Firebase Authentication SDKs available from firebase.google.com/docs/auth/

I went to firebase.google.com/docs/auth/ , but I didn't find a solution (maybe I miss it).
I made a user from the Firebase back-office.
Here is my controller :

angular.module('roomApp')
.controller('homeCtrl', function($scope, $firebaseObject) {
    // var firebaseObj = new Firebase("https://roomsaveur-4dfe8.firebaseio.com");
    console.log('tototo')

    firebase.initializeApp(config);

    const rootRef = firebase.database().ref().child('roomsaveur-4dfe8');
    const ref = rootRef.child('database');
    this.object = $firebaseObject(ref);

    firebase.auth().createUserWithEmailAndPassword(email, password).then(function(user) {
        var user = firebase.auth().currentUser;
        var email = $scope.user.email;
        var password = $scope.user.password;
        // logUser(user); // Optional
    }, function(error) {
        console.log(error)
        var errorCode = error.code;
        var errorMessage = error.message;
    });
}]);

And my HTML :

<form class="form-signin" role="form">
    <input ng-model="mail" type="email" class="form-control" placeholder="Email address" required="" autofocus="">
    <input ng-model="password" type="password" class="form-control" placeholder="Password" required="">
    <button class="btn btn-lg btn-primary btn-block" type="submit" ng-click="signIn($event)">Sign in</button>
</form> 

Thanks by advance

1
If you're just starting with Firebase, find a more up-to-date tutorial. Since you're using AngularFire, I'd start with the official documentation: github.com/firebase/angularfire#documentationFrank van Puffelen
When I follow the doc instructions for authentication, I get this error : ReferenceError: email is not defined I updated my post with the currently codeNitneq
Sounds like you're referencing email on your model but your ng-model is assigned to "mail".Eric N
Thx all for your answers, I finally use another thing to get a back end.Nitneq

1 Answers

1
votes

Your code looks right based on the old Firebase API. However, I think simpleLogin is going away, or possibly "gone", in your case. https://github.com/firebase/firebase-simple-login

You may need to update your login method to follow the new API. It looks like the old simple login wrapper is now part of the Firebase API: https://firebase.google.com/docs/auth/web/manage-users