Solved

App login/logout causes app to forget RevenueCat entitlement

  • 29 December 2023
  • 5 replies
  • 77 views

Badge +2

I’m building an app using Flutterflow, Firebase Authentication and RevenueCat.

Authentication is optional and RevenueCat App Store subscriptions are optional with a freemium model.

After a user has upgraded to a premium subscription, if they subsequently logout or login from the app (firebase auth) their RevenueCat entitlement is “forgotten”. When the user tries to subscribe again, their entitlement is “re-discovered”.

Is this intended behaviour? I swear it wasn’t doing this a few days ago, but perhaps I didn't notice. I’d prefer for the RevenueCat entitlements and Firebase Authentication to be independent.

I think this is related to anonymous app user IDs.
https://www.revenuecat.com/docs/user-ids
Is there anything I could have changed in my flutterflow setup that would trigger Flutterflow to change what kind of ID is used with Revenuecat? i.e. change from always anonymous to a mix of app IDs and anonymous? or vice versa?

icon

Best answer by Haley Pace 20 January 2024, 01:57

View original

5 replies

Userlevel 4
Badge +8

Hi, yes this sounds like the change from the types of app user ids caused this. This is happening because when you logOut(), an anonymous id is generated. I would recommend that you call syncPurchases() after logIn() as this will restore the user’s entitlement without them needing to try to subscribe again, see here: https://www.revenuecat.com/docs/restoring-purchases#syncing-purchases-without-user-interaction

Badge +2

Hi Haley, thanks for the reply. I use the FlutterFlow RevenueCat integration so I don’t think I can use the syncPurchases() call unless it is supported by FlutterFlow. I’ve changed the app implementation to require a use to be authenticated before they can choose a subscription option. This adds a little friction for the use before they can purchase, but is simpler. Do you think this will solve the problem?

Userlevel 4
Badge +8

Hi, sorry for the delay. Yes you are correct, unfortunately FlutterFlow would need to implement their own syncPurchases() method and after looking through their documentation, it appears this is not available at this time. With the current available methods, you might instead want to prompt the user to restore purchases. As long as they are logged in with the same underlying app store account that made purchases, then these will be restored and they will regain access to their entitlements: https://docs.flutterflow.io/actions/actions/integrations/revenuecat#id-5.-restoring-purchases

Requiring a user to be authenticated before choosing a subscription option can help, but this might not be fixing the issue. This is because anonymous ids can still be generated if login isn’t required on app startup and if the user logs out (due to calling configure() without a custom id and using logOut()).

The best thing to do here would be to stop using anonymous ids and to just use custom app user ids.

Unfortunately I do not have too much insight into how FlutterFlow is using RevenueCat behind the scenes in regards to how they are configuring and if there is even an option to configure with a custom id on startup and to switch users via login, so I would recommend reaching out to them to ask. I would also share this doc with them which explains how to only use custom ids which will eliminate anymore anonymous ids from being generated for your app: https://www.revenuecat.com/docs/user-ids#how-to-only-use-custom-app-user-ids

Badge +2

Thanks Hayley for the really clear response. I appreciate it.

Badge +2

Hello @Haley Pace ,

I’m seeing the same error on Capacitor. 

This is the current flow:

  1. User Purchases In-App-Subscription → Premium Features Availaibe
  2. User creates an account in the app to use premium features on the website → App calls Purchases.login() → Premium Features Gone

Without calling Purchases.login, premium features stay available.

Reply