#Emanuel-firebase
1 messages ยท Page 1 of 1 (latest)
hi, unfortunately I have no idea, I haven't used Firebase or those extensions we have myself and know nothing about how to work with its collections.
Hey, stepping in here as I have a bit of context around Firebase and our extensions
Are you not able to use the Firebase admin client to get the claims set on each of your users? https://firebase.google.com/docs/auth/admin/custom-claims#set_and_validate_custom_user_claims_via_the_admin_sdk
That might work but the client shouldn't be using the admin sdk, right?
No, but you could build an API to wrap that call that your client can talk to
You'll struggle to do this without the admin SDK, tbh
Let me give it some more thought ๐
Thanks for the input, probably need something like this
But, in theory, I could update the user-collection with the subscription state and let the clients read that state
just need to know when to update - either by trigger (fb function) or something else
You could, but then that's overhead for you to maintain
I'd probably do it via Stripe events
And have a webhook that updates the Firestore document
the extensions already have some of these setup - can I somehow re-use them, or do I need to create new ones from scratch?
Well you'd need to write your own function as a webhook endpoint for your Stripe events
You could open a PR on the extension (I maintain it) but I'm not sure it's something we'd merge
What would be brilliant is for the extension to also update named field in the user collection with the meta data as it does for the claim
Feel free to open an issue or even better a PR
np!
Emanuel-firebase
https://github.com/stripe/stripe-firebase-extensions/issues/408
here is the issue
I am not sure how to actually test my code locally in this case
admin .firestore() .doc(customersSnap.docs[0].ref) .update({stripeRole: role})
also, this might not apply for everyone so I guess it should/could be optional
I'll take a look at the issue when I have some time