0
我試圖使用REST API將數據從C#保存到我的Firebase數據庫。當我嘗試保存數據時(嘗試保存到列表),我收到了403個錯誤。我能夠從角度(使用AngularFyre)將數據保存到這個列表中,但是每次嘗試從REST API獲得403時都是如此。我的數據庫設置了默認規則,當前允許對所有內容進行讀取和寫入,這看起來像我可以從Angular保存的事實證明一樣。來自REST API的Firebase 403錯誤
我發佈的網址看起來像https:// [mydb] .firebaseio.com/subscriptions。下面是我使用的代碼:
void SaveToFirebase<T>(T objectToSave, string url)
{
var request = WebRequest.Create(url);
request.Method = "PUT";
request.ContentType = "application/json";
var stream = request.GetRequestStream();
using (var streamWriter = new StreamWriter(stream))
{
var serializedData = jsonSerializer.Serialize(objectToSave, true);
streamWriter.Write(serializedData);
streamWriter.Close();
}
stream.Close();
using (var response = request.GetResponse())
{
ThrowIfHttpSaveRequestFailed(request, response);
}
}
我加了兒子類似的問題,我越來越 – R2R