问题描述
我对 ref.once('value',callback)
进行了简单的调用.回调从未被调用.
I did a simple call to ref.once('value', callback)
. The callback never got called.
相反,我在Chrome控制台中收到此错误:拒绝显示'https://console.firebase.google.com/project/project6...redacted...73&parent=http%3A%在框架中2F%2Flocalhost%3A8204& pfname =& rpctoken = 3 ... acteded ... 4',因为它将'X-Frame-Options'设置为'DENY'.
Instead I got this error in my Chrome console: Refused to display 'https://console.firebase.google.com/project/project6...redacted...73&parent=http%3A%2F%2Flocalhost%3A8204&pfname=&rpctoken=3...redacted...4' in a frame because it set 'X-Frame-Options' to 'DENY'.
我不知道这个iFrame是什么,或者这就是为什么我没有得到回调的原因.FWIW,我在 localhost:8204
I have no idea what this iFrame is or whether that's why I didn't get a callback. FWIW, I'm running my dev app on localhost:8204
这是更完整的代码示例.
Here's a fuller code sample.
import firebase from 'firebase/app'
import 'firebase/auth'
import 'firebase/database'
firebase.initializeApp({
apiKey: config.firebaseApiKey,
authDomain: `${config.firebaseAppName}.firebaseio.com`,
databaseURL: `https://${config.firebaseAppName}.firebaseio.com`,
storageBucket: config.firebaseStorageBucket
})
const ref = firebase.database().ref()
ref.once('value', callback)
推荐答案
好吧,问题出在初始化配置 authDomain
字段中,我写了 .firebaseio.com
,但是它应该是 .firebaseapp.com
.
Ok the problem was simply in the initialization config authDomain
field, I wrote .firebaseio.com
but it should have been .firebaseapp.com
.
这篇关于Firebase 3.0.1 Web API查询无法正常工作,出现iFrame安全错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!