Skip to main content
Answer

Current app user id not original

  • August 18, 2022
  • 7 replies
  • 652 views

Forum|alt.badge.img+5

Hi,

How can I get the current App user id not the original one?
We can have purchaserInfo?.originalAppUserId but I need current app user id to differentiate between different devices of a single user.

Best answer by Jens

Are you sure? I am not talking about PurchaserInfo / CustomerInfo.originalAppUserId, I am talking about Purchases.shared.appUserId. That one should not get overwritten with the original app user ID. 

This post has been closed for comments

7 replies

Jens
RevenueCat Staff
Forum|alt.badge.img+7
  • RevenueCat Staff
  • August 18, 2022

Hey @Alireza Nazer , would’t the current app user ID be the one that you passed to logIn()? 


Forum|alt.badge.img+5
  • Author
  • Member
  • August 20, 2022

Hey @Alireza Nazer , would’t the current app user ID be the one that you passed to logIn()? 

Hi, I don't provide an App User ID of my own , I receive anonymous app user id in purchaserinfo which is the original app user id but I need the current anonymous app user id because it can vary over different devices.

We can see it in webhook events but I need it in my app when it lunches.


Jens
RevenueCat Staff
Forum|alt.badge.img+7
  • RevenueCat Staff
  • August 22, 2022

I see. You can access the app user ID from the SDK (on iOS, there’s this method, on Android, you can access it through Purchases.sharedInstance.appUserId) .


Forum|alt.badge.img+5
  • Author
  • Member
  • August 22, 2022

I see. You can access the app user ID from the SDK (on iOS, there’s this method, on Android, you can access it through Purchases.sharedInstance.appUserId) .

Yes, you are right but it returns the original app user ID which can be different from current user id.

When user runs the app on tow different devises, it returns the same app user ID, but there is different current user ID`s in webhook.


Jens
RevenueCat Staff
Forum|alt.badge.img+7
  • RevenueCat Staff
  • Answer
  • August 23, 2022

Are you sure? I am not talking about PurchaserInfo / CustomerInfo.originalAppUserId, I am talking about Purchases.shared.appUserId. That one should not get overwritten with the original app user ID. 


Forum|alt.badge.img+5
  • Author
  • Member
  • August 24, 2022

Are you sure? I am not talking about PurchaserInfo / CustomerInfo.originalAppUserId, I am talking about Purchases.shared.appUserId. That one should not get overwritten with the original app user ID. 

Yes, You are right.

I made a mistake and “Purchases.shared.appUserId” is the one which I was looking for.

Thanks a lot.


Jens
RevenueCat Staff
Forum|alt.badge.img+7
  • RevenueCat Staff
  • August 24, 2022

Fantastic, that’s great to hear! 😄