I have a Firebase application that only uses Google authentication. I want to give users that have never authenticated with my Firebase project access to parts of the database based on the uid of the auth provider. I want to retrieve the Google uids using the directory API and then store them in the whitelist node.
whitelist: {
12345678: true,
23456789`: true
},
data: {}
Then I would like to do something like this in the security rules:
"rules": {
"data": {
".read": "root.child('whitelist/' + auth.providerUid).exists()
}
}
Or something like this:
"rules": {
"data": {
".read": "root.child('whitelist/' + auth.providerData[0].uid).exists()
}
}
But is it possible to access the provider uid in the security rules? And if so, how does this work?
auth.uid
? – Frank van Puffelen