简体   繁体   中英

Firebase authentication failed

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM