简体   繁体   中英

How to get documents when authentication is required in the rules

I defined my rules in Firestore as below:

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.auth != null;
    }
  }
}

I'm using Delphi's REST Client palette components to get the data, without the rule defined above I can read the data, but when I configure it to require authentication I can't get it.

I read this documentation: https://firebase.google.com/docs/firestore/use-rest-api

Which led me to this other documentation: https://firebase.google.com/docs/reference/rest/auth/

But I didn't understand how to generate the token property. 在此处输入图片说明

I don't know the tool you use and what are its capabilities. I found some interesting materials that might be helpful in this case:

Tutorial - this friendly shows the mechanism generally and Node.js implementation.

Document - here you might find all possibilities to create custom tokens as well on third party tools which I suppose you are using.

I hope it will help!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM