Extensions: StripeRole remove 'role' from custom claims

Created on 30 Jul 2020  路  2Comments  路  Source: firebase/extensions

Bug report
firestore-stripe-subscriptions

To Reproduce

  • Create user in firestore app and set custom user claims like: admin.auth().setCustomUserClaims(user.uid, { role: 'admin' });
  • Use stripe to make a subscription for a product with firebaseRole metadata
  • If success => sign out and sign in again
  • Check user.getIdTokenResult() - 'role' will be removed
  • If you set 'role' again, it will remove stripeRole from custom claims

Expected behavior
'StripeRole' shouldn't replace/delete other custom claims.

As can I see (https://firebase.google.com/docs/auth/admin/custom-claims#set_and_validate_custom_user_claims_via_the_admin_sdk) this is expected behavior.

It means this extension is unusable if you need to use other custom claims (you need to choose between custom claims created by firebase or stripe). I need both (stripeRole to match the subscribed plan with an appropriate document in firebase collection where I defined specific limits for that plan).

bug

Most helpful comment

Hey @Arystosedes, thanks for bringing this to our attention, we'll get this looked at.

All 2 comments

Hey @Arystosedes, thanks for bringing this to our attention, we'll get this looked at.

@Arystosedes thanks for finding this issue, can you please file it to the correct repository here? https://github.com/stripe/stripe-firebase-extensions

Was this page helpful?
0 / 5 - 0 ratings