我想从 SIM800L 模块向 firebase 发送 POST 请求。到目前为止,我只收到错误 603,它告诉我我没有访问权限?
当我从安装在笔记本电脑上的 Postman 发送相同的请求时,它工作正常,读写访问权限设置为 true。
我是否必须在请求中发送某种身份验证令牌或其他东西?
提前致谢
这是arduino控制SIM800L模块的代码
#define SIM800L_RX 27
#define SIM800L_TX 26
#define SIM800L_PWRKEY 4
#define SIM800L_RST 5
#define SIM800L_POWER 23
String apn = "internet.eplus.de"; //APN
String apn_u = "eplus"; //APN-Username
String apn_p = "gprs"; //APN-Password
String url = "https://benchmark-7913c-default-rtdb.europe-west1.firebasedatabase.app/.json"; //URL of Server
void setup()
{
pinMode(SIM800L_POWER, OUTPUT);
digitalWrite(SIM800L_POWER, HIGH);
Serial.begin(115200);
Serial.println("ESP32+SIM800L AT CMD Test");
Serial2.begin(9600, SERIAL_8N1, SIM800L_TX, SIM800L_RX);
delay(15000);
while (Serial2.available()) {
Serial.write(Serial2.read());
}
delay(2000);
gsm_config_gprs();
gsm_http_post("{\"test\" : \"true\"}");
Serial.println("Done");
}
void loop() {
}
void gsm_http_post( String postdata) {
Serial.println(" --- Start GPRS & HTTP --- ");
gsm_send_serial("AT+SAPBR=1,1");
gsm_send_serial("AT+SAPBR=2,1");
gsm_send_serial("AT+HTTPINIT");
gsm_send_serial("AT+HTTPPARA=CID,1");
gsm_send_serial("AT+HTTPPARA=\"URL\"," + url);
gsm_send_serial("AT+HTTPPARA=CONTENT,application/x-www-form-urlencoded");
gsm_send_serial("AT+HTTPDATA=192,5000");
gsm_send_serial(postdata);
gsm_send_serial("AT+HTTPACTION=1");
gsm_send_serial("AT+HTTPREAD");
gsm_send_serial("AT+HTTPTERM");
gsm_send_serial("AT+SAPBR=0,1");
}
void gsm_config_gprs() {
Serial.println(" --- CONFIG GPRS --- ");
gsm_send_serial("AT+SAPBR=3,1,Contype,GPRS");
gsm_send_serial("AT+SAPBR=3,1,APN," + apn);
if (apn_u != "") {
gsm_send_serial("AT+SAPBR=3,1,USER," + apn_u);
}
if (apn_p != "") {
gsm_send_serial("AT+SAPBR=3,1,PWD," + apn_p);
}
}
void gsm_send_serial(String command) {
Serial.println("Send ->: " + command);
Serial2.println(command);
long wtimer = millis();
while (wtimer + 3000 > millis()) {
while (Serial2.available()) {
Serial.write(Serial2.read());
}
}
Serial.println();
}