火力地堡:为什么$ firebaseSimpleLogin引发SecurityError? [英] Firebase: Why $firebaseSimpleLogin throws a SecurityError?
问题描述
我想注册使用火力地堡简单登录机制的用户:
I'm trying to register users using the Firebase Simple Login mechanism:
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);
});
};
});
不过,我在控制台中看到以下错误:
But, I see the following error in the console:
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
回调。
我启用了电子邮件和放大器;密码认证,并把本地主机
在授权的请求起源的列表
I enabled the "Email & Password" authentication and put localhost
in the list of the Authorized Request Origins.
我在做什么错了?
推荐答案
简单地说,你的域(本地主机在这种情况下)为 HTTP
,而原产地是 HTTPS
,这往往导致这些类型的错误。我相信,如果它们匹配(然而,在这种情况下,既要为HTTPS),这将不再是一个问题:
Simply put, your "domain" (localhost in this case) is http
whereas the origin is https
, which tends to cause these sorts of errors. I believe if they match up (however, in this case, both MUST be HTTPS), this should no longer be an issue:
请求访问该帧具有HTTPS时,帧的协议
被访问的具有的http的一个协议。 协议必须匹配。的
The frame requesting access has a protocol of "https", the frame being accessed has a protocol of "http". Protocols must match.
一些更多的信息可以在 REST API参考找到|火力地堡文档:
Some more info can be found on the REST API Reference | Firebase Documentation:
注意,要求HTTPS。火力地堡仅响应使您的数据保持安全的加密流量
这篇关于火力地堡:为什么$ firebaseSimpleLogin引发SecurityError?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!