firestore-revenuecat-purchases icon indicating copy to clipboard operation
firestore-revenuecat-purchases copied to clipboard

Firebase auth custom claims cleanup

Open appsgenie opened this issue 1 year ago • 5 comments

One a subscription expires, should the extension remove the "revenueCatEntitlements" from the firebase auth user's custom claims?

appsgenie avatar Mar 11 '24 00:03 appsgenie

Yes, it should.

jefago avatar Mar 11 '24 11:03 jefago

hi @jefago thanks for the reply. I have cases when the claim is still part of the firebase auth claim.. and Idea where to start debugging or if this is a know issue?

appsgenie avatar Mar 25 '24 02:03 appsgenie

Do you have a customer / events collection set up as well? If so, that's the first place I would look – check if in the customers collection, the entitlement for that customer is still set, and in the events collection, if an EXPIRATION event is present for that customer.

jefago avatar Mar 25 '24 08:03 jefago

yes I do have both of those collections (as part of the RC firebase extension). and yes, the main reason I reported this is that I get an EXPIRATION event and the claims are still there. I am not sure how to look at the customers collection since that one always lists the entitlements even for expired customers. I guess the expires_date inside each entitlement would tell me if it's expired or not. but with grace periods etc it gets confusing. so to me, I rely on the events collection. once I get EXPIRATION or other flows that represent expiration then I remove user's entitlements on back-end. But the client having these still in the token is confusing..

appsgenie avatar Mar 29 '24 23:03 appsgenie

Also, what happens if the user is deleted from firebase auth? It seems that the extension currently throws an exception and I am not sure what the consequences of this are..

appsgenie avatar Apr 03 '24 18:04 appsgenie