Skip to main content
Answer

Flutter : firebase google authentication cycle with revenuecat

  • September 25, 2021
  • 1 reply
  • 422 views

Forum|alt.badge.img+4

 

we are working on a flutter app that uses firebase authentication and each user has his own unique user id , first we setup the revenuecat on the lunch of the app using this 

await Purchases.setup("public_sdk_key");
secondly when the user logs in we use its unique user id in : 

await Purchases.logIn(uuid);
thirdly and when the user logs out we use 
await Purchases.logOut();
is this the best practice and how can we handle if the user terminated his subscription while using the app

Best answer by ryan

Hey @Iqraa-lamha

That setup sounds correct! You should inspect the PurchaserInfo object to determine if the subscription for the user is still active. You won’t get pushed information if the subscription expires in the middle of app-usage, but the next time you call .getPurchaserInfo() or restart the app the latest PurchaserInfo object will be fetched.

 

The .getPurchaserInfo() call operates on a 5-minute cache, so you can call this as frequent as you’d like without worrying about rate limits, still knowing that the information won’t be more than a few minutes behind.

 

 

This post has been closed for comments

1 reply

ryan
RevenueCat Staff
Forum|alt.badge.img+9
  • RevenueCat Staff
  • Answer
  • September 28, 2021

Hey @Iqraa-lamha

That setup sounds correct! You should inspect the PurchaserInfo object to determine if the subscription for the user is still active. You won’t get pushed information if the subscription expires in the middle of app-usage, but the next time you call .getPurchaserInfo() or restart the app the latest PurchaserInfo object will be fetched.

 

The .getPurchaserInfo() call operates on a 5-minute cache, so you can call this as frequent as you’d like without worrying about rate limits, still knowing that the information won’t be more than a few minutes behind.