Skip to main content

For what I could understand from reading the docs, RevenueCat has two different methods by which we can identify the user.

  • One method is by calling Purchases.login().
  • The other method is by calling Purchases.setup().

What are the differences between these two methods of identifying the user?

At first I thought I should call Purchases.setup() in my app initialization, and the login() method should be user right after I authenticate my user in my application, but it looks like I misundersdood it, because I am having some weird errors of unexpected transfers between anonymous and authenticated UIDs.

The correct way then is to use both of these two methods but only after I know which UID to apply to the user? And the setup() method should be called only once, and after it has been called then I should only call the login method?

Hey @UlyssesAlves,

 

The setup method should be called only once, and that starts the SDK. If you pass in the appUserID to setup, it’s roughly the equivalent of doing setup + login instantly. 

 

The reason that the methods are separate is that some apps might not have the appUserID available by the time they need to call setup, so they can log in later if needed. 

 

If you call setup without an appUserID, an anonymous ID will be generated and used until you call logIn. More information on this here.


Hi again, @Andy .

Is it OK if I design my app to not configure RevenueCat for anonymous users? As I stated in my other thread, I’m working to make my app only configure RevenueCat when I have the app user id to pass to itand my app will call login only if configure has already been called previously.

I think this could impact on how many anonymous users will be reported in RevenueCat’s dashboard. This number will become much smaller, probably, becausse in my app users only need to create their account when they are ready to buy something, although in some cases the user may create his account but not finish the purchase by canceling it manually or because of a problem on the purchase process.

Besides that, is there another concern I should be aware of when I stop calling the configure method for every user, and call it only for authenticated users in my application?


Reply