Chat freely about anything...

User avatar
By phando
#42668 Hey All,
I am trying to love the NodeMCU chip but keep hitting issues at every turn. Currently I am trying to make an HTTPS Post with Bearer Token Authorization. If you have an example of making this kind of request using ArduinoIDE or ESPolorer I would love to see the syntax.

Thanks!
User avatar
By phando
#44024 Got it! :D
Turns out making https requests needs some custom firmware. Turns out there is a great resource for making custom firmware. http://nodemcu-build.com by selecting a dev build, I was able to add http with https support and successfully make my https post.

Code: Select allbody = '{"Team":1, "Item1":2, "Item2":3, "Item3":4}'

http.post('https://SOME_ENDPOINT_URL',
    'Content-Type: application/json\r\n'
  ..'Authorization: Bearer SOME_CRAZY_AUTH_KEY\r\n'
  ..'Accept-Encoding: gzip, deflate\r\n',
  body,
  function(code, data)
    if (code < 0) then
      print("HTTP request failed")
    else
      print(code, data)
    end
  end)