我收到错误“未捕获的类型错误:firebase.auth 不是函数”。
我的代码运行良好,然后我实现了我的客户端 api,发现他们的 api 已经使用并初始化了一个不同的 firebase 应用程序。因此,由于我无法以通常的方式初始化我的 firebase 应用程序(即 firebase.initializeApp(config) ),我按照以下有关初始化多个 firebase 应用程序的文档进行操作。(这会导致错误)
var configOther = {
apiKey: "xxxx",
authDomain: "xxxx",
databaseURL: "xxxx",
projectId: "xxxx",
storageBucket: "xxxx",
messagingSenderId: "xxxx"
};
var firebaseOther = firebase.initializeApp(configOther, "firebaseOther");
console.log("auth: ", firebase.auth(firebaseOther)); //"Uncaught TypeError: firebase.auth is not a function"
Run Code Online (Sandbox Code Playgroud)
关于我在这里做错了什么的任何想法?非常感谢。
注意 - 我还尝试了以下速记符号:
firebaseOther.auth()
Run Code Online (Sandbox Code Playgroud)
代替
firebase.auth(firebaseOther)
Run Code Online (Sandbox Code Playgroud)
但这会导致相同的错误。