Skip to main content
Question

How to configure Flutter SDK based on login method

  • October 26, 2023
  • 1 reply
  • 121 views

Forum|alt.badge.img+1

Hi, 

I have an app that users can log into using either their gmail or their apple id. I want to implement the RevenueCat SDK, but in the docs, it says to configure the SDK as early as possible, usually when the app starts. 

My challenge if I do that is that, when the app starts, I don’t know which login method the user is going to use and obviously, if they are using gmail, I want to the Google API key and if they are using their Apple Id, I need to use the Apple API Key. Based on the documentation, it is my understanding that the API key is configured in the SDK at the time of the initial configuration.

My question is: if my understanding is correct, can I update the PurchasesConfiguration once the user logs in with the right API key? If that is not possible, can i configure the PurchasesConfiguration when the user logs in and “unconfigure" it when the user logs out? If none of these are possible, then how do I do this?

Thanks a lot in advance,

Bertrand.

 

 

This post has been closed for comments

1 reply

wes_clark
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • 292 replies
  • October 30, 2023

Hi,

You can delay the configuration until you have the information that you would like. You can just call login when they first open the app, wait for the user to identify whether they want to use google or apple, and then call configure once the choice has been made. However, we recommend not determining which API key to use based on login service. Here is how we recommend to initialize the SDK using Flutter.


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