Post your best Lua script examples here

User avatar
By Gaurav047
#83209 I am working on a project in lua, using the ESPlorer IDE which requires the ESP8266 to send telemetry event to google cloud iot core via http client POST request which must have the similar format as the following:

$ curl -X POST \
-H 'authorization: Bearer <your-jwt-token>' \
-H 'content-type: application/json' \
-H 'cache-control: no-cache' \
--data '{"binary_data": "aGVsbG8K"}' \
'https://cloudiotdevice.googleapis.com/v1/projects/<your-project-id>/locations/<region-name>/registries/iotcore-registry/devices/<device-name>:publishEvent'
{}

Can anyone share a few code snippets as of how to send POST requests including a JWT bearer token for authorization in the header of the POST request?
Thanks