Anonymous account

We register an anonymous account with no action or data from the user. The account credentials are stored in the browser: the user may not access the account from other devices, and may not recover the account if the credentials are deleted.

Registration of anonymous accounts doesn't trigger the beforeUserCreated() blocking function but it does trigger the auth.user().onCreate() non-blocking function.

signInAnonymously(auth)

check if the account is anonymous

On the client, we check currentUser:

auth.currentUser?.isAnonymous // is true for anonymous accounts

In Cloud Functions' auth-related functions such as user().onCreate(), we access a UserRecord user and check the providerData array. If it's empty, it is an anonymous account:

user.providerData.length === 0 // is true for anonymous accounts

convert to an email account

We link the anonymous account to an email credential that we build manually.

const credential = EmailAuthProvider.credential(email, password)
linkWithCredential(auth.currentUser, credential)

link with a Provider such as a Google account

We link the anonymous accounts to an identity provider. For example, we link to a Google account with a popup flow.

const provider = new GoogleAuthProvider()
const result = await linkWithPopup(auth.currentUser!, provider)
earlymorning logo

© Antoine Weber 2026 - All rights reserved

Anonymous account

We register an anonymous account with no action or data from the user. The account credentials are stored in the browser: the user may not access the account from other devices, and may not recover the account if the credentials are deleted.

Registration of anonymous accounts doesn't trigger the beforeUserCreated() blocking function but it does trigger the auth.user().onCreate() non-blocking function.

signInAnonymously(auth)

check if the account is anonymous

On the client, we check currentUser:

auth.currentUser?.isAnonymous // is true for anonymous accounts

In Cloud Functions' auth-related functions such as user().onCreate(), we access a UserRecord user and check the providerData array. If it's empty, it is an anonymous account:

user.providerData.length === 0 // is true for anonymous accounts

convert to an email account

We link the anonymous account to an email credential that we build manually.

const credential = EmailAuthProvider.credential(email, password)
linkWithCredential(auth.currentUser, credential)

link with a Provider such as a Google account

We link the anonymous accounts to an identity provider. For example, we link to a Google account with a popup flow.

const provider = new GoogleAuthProvider()
const result = await linkWithPopup(auth.currentUser!, provider)