Hello,
Im am going through the firebase docs for the implementation and I am on the final stage, where I check the entitlements via the firebase claims with the code below
getAuth().currentUser.getIdTokenResult() .then((idTokenResult) => { // Confirm the user has a premium entitlement. if (!!idTokenResult.claims.activeEntitlements.includes("premium")) { // Show premium UI. showPremiumUI(); } else { // Show regular user UI. showFreeUI(); } }) .catch((error) => { console.log(error); });
When I go to check the active entitlements with the code like so console.log(idTokenResult.claims.activeEntitlements) it returns undefined and when I check the returned object of just console.log(idTokenResult.claims) activeEntitlements doesn’t exist. Also I enabled claims in the firebase setup
What can possibly be the fix for this? Thanks
Question
Firebase implementation, ERROR Cannot read property 'includes' of undefined

This post has been closed for comments
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.