EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 448 forks source link

Question - Nativescript Firebase onAuthStateChanged, deleted app, redownload and data.loggedIn is still true #1796

Closed pandabuilt closed 2 years ago

pandabuilt commented 3 years ago
  try {
      await firebaseWebApi.initializeApp({
        storageBucket: '',
        persist: true,
        onAuthStateChanged: (data: any) => {
          if (data.loggedIn) {
            firebaseWebApi.auth().currentUser = data.user;
            this.zone.run(() => {
              this.routerExtension.navigate(['/dashboard'], {clearHistory: true});
            });
          } else {
            this.zone.run(() => {
              this.routerExtension.navigate(['/login'], {clearHistory: true});
            });
          }
        }
      });
    } catch (err) {
      console.log('>>>>> Firebase init error: ' + err);
    }
  }

I delete all app and content. However, when I redownload data.loggedIn comes back as true! How do I delete all related data when the app itself is deleted?

Codex- commented 3 years ago

Does this behaviour occur if you delete the app and restart the device?

pandabuilt commented 3 years ago

I did the following test:

  1. install app.
  2. Login
  3. uninstall app
  4. turn off phone
  5. turn on phone
  6. redownload app

it indeed reauthenticates

{"loggedIn":true,"user":{....

pandabuilt commented 3 years ago

Note this is on iOS - I have not tested it on Android.

jerbob92 commented 3 years ago

In case you missed it on Slack: https://stackoverflow.com/questions/27893418/firebase-deleting-and-reinstalling-app-does-not-un-authenticate-a-user