Skip to main content
Question

RevenueCat assigning $RCAnonymousID even though app requires login before configure()

  • July 10, 2025
  • 3 replies
  • 77 views

Forum|alt.badge.img+3

We’re facing an issue where RevenueCat is assigning an anonymous ID ($RCAnonymousID…) to some users, even though our app does not allow access without login, and we only call Purchases.configure() after the user signs up or logs in.

 

Our Setup:
    •    Platform: Flutter (with RevenueCat Flutter SDK)
    •    Auth system: Firebase Auth
    •    App flow: Users are required to sign in (via Firebase) before accessing any part of the app
    •    RevenueCat config: We only call Purchases.configure() after confirming that the user is signed in and have access to FirebaseAuth.instance.currentUser.uid

 

Issue Details:
    •    In about 10% of cases, we’re seeing a RevenueCat event log that looks like this:
    •    Created a new alias $RCAnonymousID:...
    •    All these users are supposedly logged in before we initialize RevenueCat
    •    For the remaining 90% of users, everything works correctly — i.e., the purchases are linked directly to our userId

Sample Event Flow (from RevenueCat dashboard):
    •    First seen using the app – shows a timestamp
    •    Started a subscription... – shows correct product and price
    •    Created a new alias $RCAnonymousID:...
    •    Last opened the app – same timestamp as signup

This suggests that the SDK is assigning the anonymous ID and linking the purchase to it, even though we believe we’ve already passed the correct user ID at configuration time.

Questions:
1) Why is RevenueCat still generating an anonymous ID for some users even though we are setting appUserID correctly?
2) How do we resolve this issue?
3) Is there a safer pattern for new user signup + purchase flow to ensure no anonymous ID is created at all?

This post has been closed for comments

3 replies

Forum|alt.badge.img+8
  • RevenueCat Staff
  • July 15, 2025

Hi,

1) Why is RevenueCat still generating an anonymous ID for some users even though we are setting appUserID correctly?

An anonymous ID will be generated by RevenueCat if configure() is called without an app user id being passed to it, if logOut() is called, or when enabling the “Track new purchases from server-to-server notifications” feature. You are not using the latter so it might be due to how you are calling configure() or if you are calling logOut(). 

 

2) How do we resolve this issue?

Can you share with me how you are callling configure() and logIn()? Once you get the custom app user id from Firebase you’ll want to pass this identifier to configure() in order to only use that custom app user id and to not generate an anonymous id. And are you calling logOut() at all?

 

3) Is there a safer pattern for new user signup + purchase flow to ensure no anonymous ID is created at all?

To never create anonymous app user ids, you’ll want to wait to call configure() until you have the app user id to pass to it, to only call logIn() for switching users not logOut(), and to not enable the “Track new purchases from server-to-server notifications” feature. See the “How to force only using Custom App User IDs” under the “Advanced Topics” section in our docs here for more details.


Forum|alt.badge.img+3
  • Author
  • New Member
  • July 16, 2025

Hi, I’m attaching below the details of point 2. 

https://docs.google.com/document/d/1rLcE1np9HyQZbdP_nYb8tCp_hxNJKCmbIPDXkhuwLG4/edit?usp=sharing

 

Looking forward to hearing from you at the earliest. 


Forum|alt.badge.img+8
  • RevenueCat Staff
  • July 22, 2025

Thank you for sharing your code! Looking at your configure/logIn block, what could be causing the anonymousID is if _userId is not populated before configure is called as if it is null then an anonymous app user id will be generated there. And if you are calling configure with the custom app user id then there is no need to call logIn() as the custom app user id is already in use. I recommend waiting to call configure until you have the _userId populated so I would do the check of if (_userId != null) before calling configure.

 

Future<void> initialize() async {
_userId = AppPreference.getUserId();
await Purchases.configure(
PurchasesConfiguration(apiKey)..appUserID = _userId,
);
if (_userId != null) {
await logIn(_userId!);
}
}