Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
162 views
in Technique[技术] by (71.8m points)

firebase - How to restrict premium features of app in flutter?

In a flutter app using firebase back end, how can the premium features of the app be restricted?

For example if the user haven't paid for subscription then only allow 10 chats per month, or something like this.

question from:https://stackoverflow.com/questions/66052997/how-to-restrict-premium-features-of-app-in-flutter

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use custom claims and enforce it with security rules.

Once a user has paid, or unlocks premium features in whatever way you see fit, then that user can get a custom claim associated with the users account in firebase. This can be checked for in frontend as well in backend.

More details and great examples at: https://firebase.google.com/docs/auth/admin/custom-claims


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...