Skip to content

firebase-auth-ktx: Users being erroneously signed out since 23.2.1 #7111

@dlgrech

Description

@dlgrech

[READ] Step 1: Are you in the right place?

Yep - this is about a specific firebase-auth library version

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: Narwhal 2025.1.1 RC 1
  • Firebase Component: firebase-auth-ktx (Database, Firestore, Storage, Functions, etc)
  • Component version: com.google.firebase:firebase-auth-ktx:23.2.1

[REQUIRED] Step 3: Users being erroneously signed out since 23.2.1

Steps to reproduce:

We're getting a deluge of reports of users being signed out (that is, their firebase auth currentUser becoming null despite recently authenticating).

I can see in adb logs that my FirebaseAuth.AuthStateListener is firing with a null currentUser property.

I also see this being logged by the auth SDK internally:

D FirebaseAuth: Notifying id token listeners about a sign-out event.
D FirebaseAuth: Notifying auth state listeners about a sign-out event.

I was previously using 23.2.0 with no problems. I see in the changelog for 23.2.1 that this version added "Enhanced security by adding encryption to Firebase Authentication data inside Android persistent storage.".

I suspect this encryption/decryption is failing for some users and reporting that the user is no longer logged in.

I have tried downgrading the library but this will seem to force all existing users to log in again (presumably because the newer library version was storing things in an encrypted fashion that older versions cannot decrypt), so i'm stuck here with no recourse for these users.

Relevant Code:

I'm detecting this situation with a FirebaseAuth.AuthStateListener

Firebase.auth.addAuthStateListener {
  val hasAuthToken = auth.currentUser != null
  // Log here..
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions