thingsboard-client-sdk icon indicating copy to clipboard operation
thingsboard-client-sdk copied to clipboard

How can I use one-way SSL authentication with ESP32?

Open JfloresIoTF opened this issue 2 years ago • 1 comments

hey, does anyone have an example of how to use one-way SSL Authentication with ESP32?

JfloresIoTF avatar Aug 19 '22 17:08 JfloresIoTF

You can use wifisecureclient for that. Instead of passing in the default WiFiClient construct the thingsboard object with a WiFiSecureClient like so:

WiFiClientSecure wifi_client;
Thingsboard thingsboard(wifi_client);

...
void setup() {
  // if using self-signed set the client to not validate the certificate
  wifi_client.setInsecure();
  thingsboard.connect("demo.thingsboard.org", "my_token", 8883);
}

pay attention to connect to thingsboard with port 8883. Also you need to have mqtts (mqtt over ssl) enabled in thingsboard.conf. Check the docu for that.

longGr avatar Aug 21 '22 12:08 longGr

@imbeacon I think this issue can be closed, the WiFiClientSecure works perfectly with the library and a few example do contain how to connect securely as well.

MathewHDYT avatar Mar 13 '23 13:03 MathewHDYT