用于3.xx的Firebase身份验证SDK [英] Firebase Authentication SDKs for 3.xx

查看:144
本文介绍了用于3.xx的Firebase身份验证SDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我尝试在Firebase 3.xx中创建新用户时,都会将错误响应显示为在console.firebase.google.com上创建的项目必须使用Firebase提供的新Firebase身份验证SDK .google.com / docs / auth /。
不知道要更改哪个代码以使用firebase 3.xx身份验证sdk?


注意:现在您的项目中可能已经安装了2个Firebase SDK。我不认为这是好的,所以我建议更新您的代码使用Firebase v3,然后删除旧的Firebase SDK导入,应该看起来像这样

 < script src =https://cdn.firebase.com/js/client/2.2.4/firebase.js>< / script> 

2)更新您的Angularfire版本。以下是如何操作:



3)更新您的代码以使用Firebase v3。例如
要使用旧Firebase检测auth状态:

$ p $ authObj $ onAuth(function(authData ){

要检测旧版Firebase的身份验证状态,您必须使用:

  $ firebaseAuth。$ onAuthStateChanged(callback [,context])

希望有帮助;)


Whenever I try to create a new user in Firebase 3.xx, I'm getting error response asProjects created at console.firebase.google.com must use the new Firebase Authentication SDKs available from firebase.google.com/docs/auth/ . Not sure which code to change to use firebase 3.xx authentication sdk?

解决方案

These are the steps to switch to Firebase v3:

1) Install Firebase v3 in your web project following these simple instructions: https://firebase.google.com/docs/web/setup#prerequisites In this link they show a code snippet you need to include. You can find it personalized for your project in your project's console>"Add firebase to your web app"

NOTE: Now you probably have 2 Firebase SDKs installed in your project. I don't think this is good so I suggest to update your code to use the Firebase v3 and then remove the older Firebase SDK import, that should look like this

<script src="https://cdn.firebase.com/js/client/2.2.4/firebase.js"></script>

2) Update your Angularfire version. Here's how to do it: ù

3) Update your code to use Firebase v3. For example To detect the auth state with the older Firebase you use:

authObj.$onAuth(function(authData) {}) 

To detect the auth state with the older Firebase you have to use:

$firebaseAuth.$onAuthStateChanged(callback[, context])

Hope it helps ;)

这篇关于用于3.xx的Firebase身份验证SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆