firebase / firebase-admin-go

Firebase Admin Go SDK
Apache License 2.0
1.13k stars 242 forks source link

AuthOverride with custom user claims #478

Closed prashanthjbabu closed 2 years ago

prashanthjbabu commented 2 years ago

I have invoked the firebase new app with an authoverride option where i pass a UID which has a custom claim like role as admin . However this seems to be failing(Permission Denied) at the firebase rules of the realtime database where i have a write condition for auth.token.role === admin .

The objective here is that I'd like the firebase admin sdk to be validated against any firebase rules . Since service accounts are exempted from firebase rules , I thought of using the authoverride option . However even though the UID that I pass as authoverride has the required claims (validated using GetUser as well ) . I still see a Permission Denied .

google-oss-bot commented 2 years ago

I found a few problems with this issue:

lahirumaramba commented 2 years ago

Do you have other rules that might be failing before it even gets to the custom claims? See rules are not filters. Here is a similar question on SO https://stackoverflow.com/questions/58447913/firebase-permission-denied

Please use Stack Overflow for usage questions in the future. Thanks!