Question

How to configure Flutter SDK based on login method

  • 26 October 2023
  • 1 reply
  • 43 views

Badge

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.

 

 


1 reply

Userlevel 3
Badge +5

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.

Reply