且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用于3.xx的Firebase身份验证SDK

更新时间:2023-12-06 08:43:34

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 ;)