Solved

How to provide new user id to someone already logged in with anonymous user id

  • 14 August 2021
  • 5 replies
  • 199 views

Badge +2

Hi everyone,

For testing purposes in sandbox mode, I would like to be able to generate a brand new user id, that would not be tied to any purchase, while staying on the same Apple device.

The scenario would be this: 

  1. A tester is logged in with an anonymous user ID, or an alias of one. 
  2. The tester makes a bunch of purchases / restore etc. operations.
  3. The tester needs to test something else as a brand new user.
  4. The tester generates a brand new user ID (provided ID), that is not an alias. 
  5. The tester is able to perform new purchase related tests as a brand new user.

I’m currently trying to make step 4 happen. I’ve tried logging out and logging in with a new provided ID, but it just creates a new alias.

From the login() chart in the docs, what I’m asking seems to be impossible but I would really like to make sure and if that is the case, find out whether there might be some type of workaround?

Any help is greatly appreciated!

icon

Best answer by cody 17 August 2021, 15:08

View original

5 replies

Userlevel 6
Badge +8

Hey @Sofia CHEVROLAT! 👋

I think you’re correct- I don’t think this particular use-case is supported. When ‘logIn’ is called on an anonymous ID, we’ll alias the non-anonymous ID with the anonymous ID. At the same time, we don’t support ‘logOut’ on an anonymous ID.

A workaround for now may be to call the deprecated ‘reset’ method - this should generate a new anonymous ID, although as it’s marked deprecated, this may not be supported in the long term. If you’re just using this for testing, this should be safe to try to use.

Otherwise, I’d recommend deleting the user from the dashboard and/or doing a fresh install of the app to generate a new ID. Let me know if that helps!

Badge +2

Thank you for this thorough answer, Cody! Super helpful! 

Have a great day!

 

Badge +2

Hi Cody,

So actually, I’m a bit baffled by what I’m currently seeing.

I’m configuring with only the API key first. 

Then, I’m logging in with $RCAnonymousID:XXXX or its alias  _UUUU. They exist in RC. It has my test purchases etc.

I quit the app and restart it.

I then call logIn with a brand new provided ID, that does not exist in RC.

It works in that 0 purchases are shown, and I can purchase new ones.

I purchase something, quit the app and restart it.

I then call logIn with yet another brand new ID, but then it doesn’t work because it shows the previous purchases. 

It’s like the opposite of what you mentioned? As in, I can log out from an anonymous user ($RCAnonymousID:XXXX) but not from a Provided User?
 

I’m very confused. Could you shed some light on this behavior?

Badge +2

I’ve continued to test and actually, everything seems fine in the dashboard and the API: both new users are considered brand new. There is no entitlements for them in the dashboard or via the API. 

The second new ID fails in buying with a pop up “You are already subscribed to this”. 

The API log shows the following error message “ERROR: 😿‼️ There is already another active subscriber using the same receipt.”

Would you know what this means and why I get the error only after on the second try?

 

Thanks!

Badge +2

Update: 

I found this question 

 and that seems to say that this should never be able to work, but it does the first time… 

Reply