简体   繁体   English

Postman Google API 请求给出“401:未经授权”

[英]Postman Google API request gives “401: Unauthorized”

I'm sending post request via postman我正在通过邮递员发送邮寄请求

https://my_app_id.firebaseio.com/databases/locations/documents/123456/1598539394290.json?key=WEB_API_KEY

Json:杰森:

{"latitude":12.345678,"longitude":12.345678,"timestamp":1598539394290,"userId":"123456"}

And getting error 401 Unauthorized with Json " {"error": "Permission denied"} "并得到错误401 Unauthorized with Json " {"error": "Permission denied"} "

Permissions at Firestore: Firestore 的权限:

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

Earlier I sent there request via google java SDK and everyting was ok, but for now I need to redo this via using API.早些时候我通过 google java SDK 向那里发送了请求并且一切正常,但现在我需要通过使用 API 重做这个。

Please, help to figure out what is wrong.请帮助找出问题所在。

The security rules you're showing are for Firestore, but the URL you're using is writing to Realtime Database, which is a completely different database.您显示的安全规则适用于 Firestore,但您使用的 URL 正在写入实时数据库,这是一个完全不同的数据库。 Actually, it looks like you're combining elements of the Firestore with Realtime Database APIs in that URL, which is very confusing.实际上,您似乎在该 URL 中将 Firestore 的元素与实时数据库 API 相结合,这非常令人困惑。

If you want to write to Firestore, you should be using only the Firestore REST API documentation .如果您想写信给公司的FireStore,你应该使用公司的FireStore REST API文档 Ignore everything you see in the Realtime Database API documentation .忽略您在实时数据库 API 文档中看到的所有内容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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