How to make authenticated HTTP POST request to API

Have you tried this one?

[Create Auth Token]
https://www.arduino.cc/reference/en/iot/api/

Also, You may also find getToken function in main.js helpful.