colinhacks / next-firebase-ssr

An Next.js example repo for building authenticated pages with Firebase Authentication, cookies, and getServerSideProps
https://vriad.com/essays/nextjs-firebase-authentication
424 stars 61 forks source link

How could Firebase claims be used with this implementation? #18

Open RichardSPrins opened 3 years ago

RichardSPrins commented 3 years ago

I am using Firebase auth and Firestore for my app, and basically used the same flow as described/used in this repo, but I have 2 types of users and will have 2 types of UI depending on the user role. Default role will be a student, but in the event they upgrade to a Stripe subscription, they assume the role of coach and can take on students of their own. I have found that claims are the best way to implement this, but aside from that knowledge, actually using them properly is a concept that still escapes me.

richyrb00 commented 3 years ago

This goes outside of the framework of this example and something you should ask on stackoverflow.

but when you fetch data from firestore you would get the "role" of the user and provide logic based on that.

if student then show this component if coach then show this other component.