离子:默默地登录“管理员”帐户到Firebase

时间:2017-04-03 16:29:19

标签: firebase ionic-framework angularfire

我正在localhost上运行Ionic应用程序。我需要登录“admin”帐户来管理一些数据。运行以下代码时出现附加错误:

firebase.initializeApp({
      apiKey: "****",
      authDomain: "****.firebaseapp.com",
      databaseURL: "https://****.firebaseio.com",
      storageBucket: "****.appspot.com",
      messagingSenderId: "****"
});

this.db = firebase.database();
this.db.ref('/settings').once('value').then((snap)=>console.log(snap.val()))

我认为问题是我没有经过身份验证(我暂时将firebase规则更改为read / write = true并且错误消失了)。我该如何进行身份验证?也许,我必须使用不同的方法? (我使用angularfire尝试了很多,没有成功)

感谢。

enter image description here

1 个答案:

答案 0 :(得分:0)

我选择了1)注销然后2)匿名登录

https://firebase.google.com/docs/auth/web/anonymous-auth

相关问题