Skip to main content
Solved

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


Forum|alt.badge.img+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

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: https://www.revenuecat.com/docs/user-ids#how-to-only-use-custom-app-user-ids

 

 

View original
Did this post help you find an answer to your question?

5 replies

Forum|alt.badge.img+8
  • RevenueCat Staff
  • 552 replies
  • Answer
  • May 3, 2023

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: https://www.revenuecat.com/docs/user-ids#how-to-only-use-custom-app-user-ids

 

 


Forum|alt.badge.img+2
  • Author
  • Active Member
  • 10 replies
  • May 3, 2023

Many thanks for the clarification, Haley.
 


Forum|alt.badge.img+1
  • Active Member
  • 10 replies
  • April 10, 2025

The link posted by ​@Haley Pace is broken. The closest I could find now is this: https://www.revenuecat.com/docs/customers/identifying-customers#only-configure-the-sdk-with-a-custom-app-user-id

Unfortunately there doesn’t seem to be any way of checking if `configure()` has already been called or not, so the suggestions at the link above are a bit difficult to implement reliably.


joan-cardona
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • 363 replies
  • April 14, 2025

Hi ​@tobbe,

That link is now the first question/answer in Advance topics that you can find here.

You should be able to find the `Purchases.isConfigured` method in the SDK that you use which returns a boolean with the status.

 

Best,


Forum|alt.badge.img+1
  • Active Member
  • 10 replies
  • April 14, 2025

> That link is now the first question/answer in Advance topics that you can find here.

Yeah, that’s exactly what I linked to in my post 👍

 

> You should be able to find the `Purchases.isConfigured` method in the SDK that you use which returns a boolean with the status.

The problem with isConfigured() is that it throws an error if you haven’t configured the SDK yet :D 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings