I need some serious help as I think I messed things up with my latest code update. I use the Flutter SDK and this is what I do when the app starts up:
configuration.purchasesAreCompletedBy = PurchasesAreCompletedByRevenueCat();
if (authService.currentUser != null) {
configuration.appUserID = authService.currentUser!.uid;
}
await Purchases.configure(configuration);
if (authService.currentUser != null) {
if (authService.currentUser!.displayName != null) {
Purchases.setDisplayName(authService.currentUser!.displayName!);
}
if (authService.currentUser!.email != null) {
Purchases.setEmail(authService.currentUser!.email!);
}
} else {
log.t('4. User is not logged in, setting app user ID to null');
configuration.appUserID = null;
}
The authService just checks if the user is logged in and if they are, it assigns the actual uid from the app to the user account so that I can find them quickly.
However, I noticed with this code, my subscriber from last week who didn’t have their UID set as I had a bug in this code (I called Purchases.configure AFTER setting the displayName / email instead of before) had multiple aliases created this morning:
Last opened the app
2025-05-15 at 08:01 AM UTC
Created a new alias $RCAnonymousID:REDACTED9f11
2025-05-15 at 07:12 AM UTC
Created a new alias K<REDACTED CORRECT UID FROM APP>1
2025-05-15 at 07:12 AM UTC
Created a new alias $RCAnonymousID:REDACTED4ff29
2025-05-15 at 07:11 AM UTC
They now have three anonymous alias and the correct UID from the app. This isn’t because they were using a different device - I can see it’s all from the same device. Can anyone please help?
I had another user complain to say that their entitlement was taken away and I found one account with just their email address and another account with their email address and UID (the entitlement seemed to have worked until I did the update with the code as above).
I fear I may have broken things!!!
In fact, I just checked and noticed that one of my other subscribers had a new account created when they downloaded my new app version. Can anyone spot issues here?