我试图使用Firebase简单登录机制注册用户:
angular.module('MyApp').controller('LoginCtrl', function($scope, $firebaseSimpleLogin, FIREBASE_ROOT) {
$scope.loginService = $firebaseSimpleLogin(new Firebase(FIREBASE_ROOT));
$scope.user = {
email: '',
password: ''
};
$scope.register = function() {
console.log('creating user...'); // I see this
$scope.loginService.$createUser($scope.email, $scope.password).then(function(user) {
console.log('done!'); // But not this
console.log(user);
});
};
});但是,我在控制台中看到了以下错误:
Uncaught SecurityError: Blocked a frame with origin
"https://s-dal5-nss-15.firebaseio.com" from accessing a frame with origin
"http://localhost:8100". The frame requesting access has a protocol of "https",
the frame being accessed has a protocol of "http". Protocols must match.并且,不执行$createUser回调。
我启用了"Email & Password“身份验证,并将localhost放在授权请求来源列表中。
我做错了什么?
发布于 2014-06-26 13:33:15
简单地说,您的“域”(本例中的本地主机)是http,而原点是https,这往往会导致这类错误。我相信,如果两者相匹配(但在这种情况下,两者都必须是HTTPS),这就不再是一个问题了:
请求访问的帧具有"https“协议,所访问的帧具有"http”协议。协议必须匹配.
更多的信息可以在REST引用/ Firebase文档上找到。
注意: HTTPS是必需的。Firebase只对加密的流量作出响应,这样您的数据才能保持安全。
https://stackoverflow.com/questions/24431924
复制相似问题