簡體   English   中英

Postman Google API 請求給出“401:未經授權”

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

我正在通過郵遞員發送郵寄請求

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

傑森:

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

並得到錯誤401 Unauthorized with Json " {"error": "Permission denied"} "

Firestore 的權限:

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

早些時候我通過 google java SDK 向那里發送了請求並且一切正常,但現在我需要通過使用 API 重做這個。

請幫助找出問題所在。

您顯示的安全規則適用於 Firestore,但您使用的 URL 正在寫入實時數據庫,這是一個完全不同的數據庫。 實際上,您似乎在該 URL 中將 Firestore 的元素與實時數據庫 API 相結合,這非常令人困惑。

如果您想寫信給公司的FireStore,你應該使用公司的FireStore REST API文檔 忽略您在實時數據庫 API 文檔中看到的所有內容

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM