easy-firebase icon indicating copy to clipboard operation
easy-firebase copied to clipboard

IOS EasyAuth.signOut() does not sign out.

Open dankelley2 opened this issue 2 years ago • 1 comments

Love the design of your library, though I'm having a few issues with EasyAuth.

I've been attempting to use easy-firebase for a basic email authentication IOS app, and it seems there there are some issues in the IOS example that are also happening when I implement the library with the base instructions provided.

Reproducible by compiling the latest IOS example, signing in with email, and attempting to sign out.

IOS 16.2 Iphone 14 Pro easy-firebase 1.4.3

Firestore rules:

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.auth != null;
    }
  }
}

After setting the state of my app to "signed out", which brings my app back to it's original Sign In form, and running "EasyAuth.signOut()", I receive the following logged errors:

Screenshot 2023-03-06 at 12 33 32 PM

This is not a problem if I change my firestore rules to just "allow read, write;" (which is certainly not a solution). Is there a listener that could still be attached when the sign out function succeeds and my auth header is no longer valid?

dankelley2 avatar Mar 06 '23 18:03 dankelley2

It looks like stopping the listener before the guard check at onUserUpdate is fixing this issue in my case (swapping lines) 144 / 145:

Screenshot 2023-03-06 at 1 54 43 PM

Is there any reason why you want to keep the listener running if Auth._currentuser becomes nil?

dankelley2 avatar Mar 06 '23 19:03 dankelley2