如果我没记错,那么您使用的是这个错误。应该:
service firebase.storage { match /b/{bucket}/o { match /{environment}/{client_id}/{allPaths=**} { allow read: if request.auth.uid == client_id } }}令牌返回其他对象,例如:
- 电子邮件
- email_verified
- 电话号码
- 名称
- 子
因此,为了能够比较您必须使用的用户ID
request.auth.uid。这种方式将比较cliente客户ID。如果您想看一下文档,那么一切都可以了
request.auth。
编辑
如果您想要自己的自定义令牌,例如:
request.auth.token.client_id,则需要使用Python中的以下代码来完成:
uid = 'some-uid'additional_claims = { 'client_id': your_custom_client_id}custom_token = auth.create_custom_token(uid, additional_claims)然后,您可以在存储规则中使用:
service firebase.storage { match /b/{bucket}/o { match /{environment}/{client_id}/{allPaths=**} { allow read: if request.auth.token.client_id == client_id } }}查看文档



