I'm using the Run Payments with Stripe Firebase Extension.
I set a metadata field in the Stripe Product of: userRole: premium.
The webhook returns userRole: premium in Firestore under Users >> subscriptions >> metadata.userRole.
But I expected the webhook to attach userRole to Firebase's auth.currentUser instance. Which I was planning to query for using the function below.
How can I make the webhook return this metadata to auth.currentUser?
import { auth } from '../src/utils/init-firebase';
export default async function isUserPremium() {
await auth.currentUser?.getIdToken(true);
const decodedToken = await auth.currentUser?.getIdTokenResult();
console.log(decodedToken);
return decodedToken?.claims?.userRole ? true : false;
// return decodedToken?.claims?.stripeRole ? true : false;
}