Ric*_*Ric 2 javascript firebase firebase-authentication
我收到错误“未捕获的类型错误: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)
但这会导致相同的错误。
Dou*_*son 11
您可能跳过了在页面中包含 firebase-auth 脚本的步骤,如文档所述:
<!-- Firebase App is always required and must be first -->
<script src="https://www.gstatic.com/firebasejs/5.9.1/firebase-app.js"></script>
<!-- Add additional services that you want to use -->
<script src="https://www.gstatic.com/firebasejs/5.9.1/firebase-auth.js"></script>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11397 次 |
| 最近记录: |