AngularFire Simple Login (email / password) - access control-allow-source / unknown error

So I'm trying to do what seems like the deadliest simplest version of SimpleLogin email / password authentication in my AngularJS app. I have a forge configured for my application, I can successfully read and write data to it, and I use this link for my authentication. I turned on email / password authentication in my dashboard and added one logged in user who I am trying to authenticate with. I have no other forms of authentication.

NOTE. I run this code locally in 127.0.0.1:9000, so I don’t know if this has anything to do with the result or not (I hope not, I don’t want to create this on a real server ...)

In any case, the code ...

=======================================

This is literally everything that I have in my opinion:

<button ng-click="dummySignin()">Dummy Signin</button>

And here is my Angular code:

angular.module('myApp')
  .controller('MainCtrl', function ($scope, $firebaseSimpleLogin) {
    var ref = new Firebase('https://dummyapp.firebaseio.com/myforge');
    $scope.auth = $firebaseSimpleLogin(ref);

    $scope.dummySignin = function() {
      console.log('signing in...');

      $scope.auth.$login('password', {
        email: 'guy@face.com',
        password: 'cookie'
      }).then(function(user) {
        console.log('user: ', user);
      }, function(error) {
        console.log('error: ', error);
      });
    };
  );
});

I know that the Firebase link is configured correctly, because when I try to use a random email address, I return an error INVALID EMAIL. When I use the correct email address, this returns JSON:

error: {
  code: "UNKNOWN_ERROR",
  data: {
    message: "FirebaseSimpleLogin: FirebaseSimpleLogin: An unknown error occurred."
  }
}

In addition, I get this message on my console (as an error, not via console.log):

XMLHttpRequest cannot load https://auth.firebase.com/auth/firebase?email=guy%40face.com&password=cookie&firebase=127.0&v=1.3.1. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:9000' is therefore not allowed access.]

localhost 127.0.0.1 , , ( ), OAuth, Facebook Twitter. , firebase , localhost (, -, ...), , , , .

, , , . ?

+4
1

UPDATE:

, Firebase, :

Firebase Simple Login Firebase (.. new Firebase(...)), Angular AngularFire. itemListService new Firebase('https://myapp.firebaseio.com/'), .

(-, , ), "FirebaseService", :

$scope.auth = $firebaseSimpleLogin(FirebaseService);

:

var firebaseRef = new Firebase('http://myapp.firebasio.com');
$scope.auth = $firebaseSimpleLogin(firebaseRef);

, , Firebase ( ), Firebase $scope.auth, $login() on.

, !

+3

Source: https://habr.com/ru/post/1537608/


All Articles