Use HTTPS Securely
Make encrypted requests with TLS.
Use HTTPS Securely is a free Arduino & IoT Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Arduino & IoT Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Plain HTTP Is Open
Regular HTTP sends everything in the clear. Anyone on the path can read your data, including any tokens or passwords. 🔓
HTTPS Adds Encryption
HTTPS wraps your request in TLS encryption. Snoopers see only scrambled bytes, not your readings or credentials.
It Also Proves Identity
HTTPS does more than hide data. It checks the server is the real one using a certificate, so you are not fooled by an impostor.
Use a Secure Client
On ESP32 you swap the plain client for a WiFiClientSecure. This is the object that speaks TLS for you.
#include <WiFiClientSecure.h>
WiFiClientSecure client;Point to an HTTPS URL
Pass the secure client and an https URL to begin(). The s in https is what triggers the encrypted path.
http.begin(client, "https://api.example.com/data");Trust the Right Server
To verify identity, give the client the server's root certificate. The board uses it to confirm the connection is genuine.
client.setCACert(rootCA);Avoid setInsecure
Calling setInsecure() skips certificate checks. It is handy for a quick test but unsafe for any real, shipped device.
client.setInsecure(); // testing onlyKeep the Clock Correct
Certificate checks compare dates, so your device needs the right time. Sync it with NTP or validation may fail.
TLS Costs Resources
Encryption uses extra memory and CPU. Reuse a connection where you can instead of opening a fresh TLS handshake each time.
Never Hardcode Secrets
HTTPS protects data in transit, not secrets baked into your code. Keep API keys out of plain source and out of public repos.
Default to Secure
For anything leaving your home network, prefer HTTPS. Treat plain HTTP as fine only for quick local experiments.
Quick Check
What does HTTPS give you that plain HTTP does not?
Recap
You switched to a WiFiClientSecure, used https URLs, verified the server with a root certificate, kept the clock right, and guarded your secrets. 🎉
Frequently asked questions
Is the “Use HTTPS Securely” lesson free?
Yes — the full text of “Use HTTPS Securely” is free to read here on the web, and the Arduino & IoT Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Arduino & IoT Academy course, upgrade to CoddyKit PRO.
What will I learn in “Use HTTPS Securely”?
Make encrypted requests with TLS. You practise Arduino & IoT Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Arduino & IoT Academy?
No prior experience is required. Arduino & IoT Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Use HTTPS Securely” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Arduino & IoT Academy lesson?
Yes. Every Arduino & IoT Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- GET Data from an API
- POST Sensor Readings
- Parse JSON Responses
- Use HTTPS Securely