firestore-revenuecat-purchases
firestore-revenuecat-purchases copied to clipboard
Firebase auth custom claims cleanup
One a subscription expires, should the extension remove the "revenueCatEntitlements" from the firebase auth user's custom claims?
Yes, it should.
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?
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.
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..
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..