Hello. I have been facing some problems when it comes to adding a TOKEN to the HTTP request header, which is POST type, with the SIM800L GPS module.
I'm using this module:
Andtheproblemiswhenaddinganinformationintheheader.ItriedusingAT+HTTPPARA="USERDATA","Authorization: Bearer <Token aqui>"
, but I could not return the HTTP Status 200
I want, finally it returns HTTP Status 401
.
I am using the following AT commands to configure the module, get connection, and send the post request. Note: In another example, I can send data via POST of good, since I do not need to report a token. So it works normally.
AT+SAPBR=3,1,"APN","timbrasil.br"
OK
AT+SAPBR=3,1,"USER","tim"
OK
AT+SAPBR=3,1,"PWD","tim"
OK
AT+SAPBR=1,1
OK
AT+SAPBR=2,1
+SAPBR: 1,1,"100.82.122.155"
OK
AT+HTTPINIT
OK
AT+HTTPPARA="URL","http://adonis.jonathangaldino.com/metrics"
OK
AT+HTTPPARA="CONTENT","application/json"
OK
AT+HTTPPARA="USERDATA","Authorization: Bearer <TOKEN AQUI>"
OK
AT+HTTPDATA=42,10000
DOWNLOAD
<Aqui é o conteúdo da requisição POST> {"type":"Condutivity","value":340}
OK
AT+HTTPACTION=1
OK
When I make the request using the Insomnia , it looks more like this:
> POST /metrics HTTP/1.1
> Host: 127.0.0.1
> User-Agent: insomnia/6.2.0
> Content-Type: application/json
> Authorization: Bearer <TOKEN AQUI>
> Accept: */*
> Content-Length: 42
{
"type": "Condutivity",
"value": 1340
}
Finally, I would like to say that I've already tested AT+HTTPPARA="USERDATA","..."
in different ways and ways: (
I already tested it and it did not work:
1. AT+HTTPPARA="USERDATA","<token>";
2. AT+HTTPPARA="USERDATA","Authorization: <token>";
3. AT+HTTPPARA="USERDATA","Authorization: Bearer <token>";
4. AT+HTTPPARA="USERDATA","Bearer <token>";