robingenz / capacitor-firebase-authentication-demo

⚡️ Simple Ionic Angular app to demonstrate the use of the Capacitor Firebase Authentication plugin.
MIT License
26 stars 12 forks source link

bug: user has to sign in again after the app is closed on iOS #228

Closed cjhoward92 closed 1 month ago

cjhoward92 commented 1 month ago

Describe the bug

If a signed in user completely closes the app and then re-opens it on iOS, the authStateChange listener returns a null user record and the user is forced to sign in again. It seems like the user is not being persisted to the phone.

To Reproduce

Create a basic iOS capacitor app and try it - If it works I have no idea how.

Expected behavior

Once registered, the authStateChange listener should return a user after the app is re-opened. It only ever returns null.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context skipNativeAuth: false in the config

"node_modules/@capacitor-firebase/authentication": {
      "version": "6.1.0",
      "resolved": "https://registry.npmjs.org/@capacitor-firebase/authentication/-/authentication-6.1.0.tgz",
      "integrity": "sha512-mJbbCJFhKi/aKNuoDKAgC98EgRSfg0LxoM5lDoGqQrMwp75WDvOSxsjMUMtuuKFKJ9ASofnVYvJ3aigCpLyssw==",
      "funding": [
        {
          "type": "github",
          "url": "https://github.com/sponsors/capawesome-team/"
        },
        {
          "type": "opencollective",
          "url": "https://opencollective.com/capawesome"
        }
      ],
      "license": "Apache-2.0",
      "peerDependencies": {
        "@capacitor/core": "^6.0.0",
        "firebase": "^10.9.0"
      },
      "peerDependenciesMeta": {
        "firebase": {
          "optional": true
        }
      }
    },

We have confirmed that everything is set up fine - we can log in with email/password however the user doesn't stay logged in.

We also have the firebase js sdk installed which works fine on the web. We are going to isolate out just the capacitor firebase package and see if the problem is conflicting firebase sdks, but considering the documentation states they can be used in tandem, I'm not so sure this is the problem.

Note: I just tested on android and the code I have works fine. This seems to be an iOS issue

cjhoward92 commented 1 month ago

Turns out we had both version 11 and version 10.20 installed in the same directory (unsure how) so that was the issue.