Do I ever need to use Purchases.logIn() if I'm using Purchases.configure() including the appUserId ?

  • 29 April 2023
  • 2 replies

Badge +2


I always have a known user ID before I get to my paywall, so do I ever need to use Purchases.logIn() ?

If I sign out, I don’t call Purchases.logOut() because I don’t want to generate an anonymous ID, but when I get another user coming through and hitting the paywall, is it sufficient just to call Purchases.configure() again integrating the new appUserId?

I’m just concerned that I’m using a ‘configure’ function for setting the apiKey which should only really be done once per session but I’m doing that every time I sign in a new user when it seems more sensible to use a logIn function.

Are there any downsides (apart from a wasted resetting of the apiKey) with the way I’m doing this?

I mean, it seems to be working…..

Many thanks.


Best answer by Haley Pace 3 May 2023, 19:27

View original

2 replies

Userlevel 4
Badge +8

Hi, you do not want to call configure() more than once as you only want one instance of the Purchases SDK and calling it more than once can cause unwanted behavior. You will instead want to use logIn() if a different user will be using the app in the same session and you do not need to call logOut() when switching users as logIn() is sufficient. Please see our guide here on how to configure with only custom ids for more details on this:



Badge +2

Many thanks for the clarification, Haley.