Firebase Auth: force-quitting the app created anonymous accounts in bulk (waiting for currentUser to restore)

日本語版

Development log of Torecadash / October 2026

In my iOS app, Torecadash, a user reported: “once I kill the app, it asks me to sign in with Apple again.” When I looked, 17 of the 19 users were anonymous accounts that had been created and thrown away. The cause was how I checked, with a single line, right after launch. This is from my hand-over notes and the commit record (August 14, 2026).

The symptom

It only happened when the app was fully quit by swiping it away and then launched again. Leaving to the home screen and coming back did not trigger it.

Looking at the real data

I opened the Authentication user list in the Firebase console:

UsersCount
Total19
Signed in with Apple2
Throwaway anonymous accounts (created and last signed in on the same day)17

Ten of the 17 were from August 13 alone. A new anonymous account was being created every time the app started again.

Cause: reading something that had not been restored yet, synchronously

Right after launch, the app checked Auth.auth().currentUser on the spot. If nobody was signed in, it created a new anonymous account.

But as Firebase’s own documentation says, currentUser is not guaranteed to be restored from the Keychain yet right after launch. If restoration is late, it looks as if nobody is signed in. Then, just before the existing Apple sign-in state is restored, the app creates a new anonymous account. It is a race condition.

The race only happens on a cold start. When the app returns from the background, Firebase is not initialized again, so it does not happen. That matches the report exactly.

The fix

One more thing I found

During the investigation I learned that Sign in with Apple had never succeeded on a real device since I implemented it on August 7.

What I have not verified

This is an iOS-side change, so I cannot confirm the effect on a real device until it reaches TestFlight. My notes say the top priority is to check that the Apple link survives repeated force-quits and relaunches. There is no result in the record at the time of writing.

What I learned

The state right after launch is not settled yet.

This article summarizes my hand-over notes and the commit record (August 14, 2026).

This is the English version of the original Japanese article.

More in English