Skip to main content
Question

RevenueCat returns $RCAnonymousID despite passing custom App User ID in configure()


Forum|alt.badge.img+3

I'm experiencing unexpected behavior when using a custom App User ID with react-native-purchases.

At app start, I call Purchases.configure exactly once (on every login) and immediately provide the Cognito sub as appUserID:
 

const cognitoSub = await Storage.getUser(); Purchases.configure({ apiKey: ..., appUserID: cognitoSub, });

However, when calling await Purchases.logIn(cognitoSub) shortly after, the customerInfo.originalAppUserIdstill returns an anonymous ID ($RCAnonymousID...).

Even when purchases are restored, the originalAppUserId is still the anonymous ID, not the custom one passed to configure(). This leads to purchases being restorable across multiple user accounts on the same device, which should not be possible.

What’s strange is that in TestFlight restoring purchases with a different account on the same device failed, as intended.

But in production, any user on the same device can restore the purchase, even with a different Cognito ID.

I’m using the latest libraries:

"react-native-purchases": "^8.9.2", "react-native-purchases-ui": "^8.9.2"

Am I missing something? I read in the docs that .configure() must be called only once and after the custom App User ID is available — which I’m doing. Still, an anonymous ID is being generated. I have experienced this only on iOS so far. 

Any help is appreciated!

Edit:

I’ve checked the docs again and found the Restore Behavior. I have changed my Project Settings to Keep with original user id. I will check if that fixes the issue!

 https://www.revenuecat.com/docs/projects/restore-behavior

This post has been closed for comments

2 replies

Forum|alt.badge.img+3
  • Author
  • New Member
  • 2 replies
  • April 4, 2025

Yes, exactly — that was the missing piece. Changing the restore behavior fixed the issue, it’s now working as expected!


joan-cardona
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • 371 replies
  • April 10, 2025

Hi ​@rtn17,

I’m glad you found the solution! The restore behavior is tricky and easy to misconfigure but I’m sure that this post will be helpful to other developers, thank you.

 

Best,


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings