Solved

Current app user id not original

  • 18 August 2022
  • 7 replies
  • 238 views

Badge +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.

icon

Best answer by Jens 23 August 2022, 10:58

View original

7 replies

Userlevel 5
Badge +7

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

Badge +5

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.

Userlevel 5
Badge +7

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) .

Badge +5

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.

Userlevel 5
Badge +7

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. 

Badge +5

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.

Userlevel 5
Badge +7

Fantastic, that’s great to hear! 😄

Reply