Firebase Authorization Roles

Hi there,

I’m struggling a bit getting Firebase Auth setup. I was able to get basic login/logout working using the instructions in the docs, however, cannot figure out how to set up roles properly.

I’m following the instructions here: Cookbook - Role-based Access Control (RBAC) : RedwoodJS Docs

And have added the correct tables in prisma. Specifically, how do I link firebase <> db and create a new entry upon a new firebase signup?

Thanks!

1 Like

Ok I was able to make some progress using firebase “user claims” to store the roles information. The Redwood docs say it isn’t possible to store roles with firebase, but I believe it is (it might be a new feature: firebase docs link).

 adminApp
   .auth()
   .setCustomUserClaims(user.uid, { roles: ['admin'] })

Then in getCurrentUser (in auth.ts), I’m seeing the roles show up properly in the decoded variable.