Every device needs a unique AuthToken in order to authenticate in Blynk.Cloud. During prototyping, you can manually add AuthToken to every device. However, when working with commercial products you would need a scalable approach to eliminate manual work.
Why use dynamic AuthTokens
With this approach, you don't have to flash different AuthTokens onto every device. You can use the same firmware on every device, which significantly simplifies the production process.
Dynamic AuthTokens workflow is included in Blynk.Edgent and works out-of-the-box.
This flow is integrated with Blynk.Apps providing great user experience for end customers.
Dynamic AuthTokens works only with Wi-Fi devices. Supported devices are: ESP32, ESP8266, WiO Terminal by Seeed, Arduino MKR1010, Arduino Nano 33IoT, and Texas Instruments CC3220. Raspberry Pi will be supported soon.
How Dynamic AuthTokens work
Dynamic AuthToken generation is a part of the device provisioning process:
In the beginning, your device will act as an Access Point (AP). It means that your device will broadcast its own WiFi network with an SSID (name) similar to Blynk Device-1234
Your smartphone will connect to this AP with the Blynk app (or from smartphone settings) and they will start communicating directly with each other over WiFi
Blynk app will ask your customers for the name (SSID) and password of the WiFi network they would like to connect their device to.
WiFi information (SSID and password) will be sent to the device.
Also, Blynk app will request a new AuthToken from the server and send this AuthToken to the device.
Device will store all of these parameters in Flash/EEPROM memory
After that, device will automatically reboot. The AP mode will be turned off.
Device will use the WiFi credentials your client provided to connect to their home or office WiFi network
After the successful authentication, the device is added to their account and ready to use
If they later need to connect to this device to a different network, WiFi credentials can be changed by using Blynk app, by resetting the device with a physical button (you would need to plan it into your electrical circuit design)
In general, Blynk.Edgent covers everything you need to enable your productst to get AuthTokens Following this guide will give you a full understanding of how this process works.