WiFi device provisioning is probably the single biggest pain point in launching an IoT product. There are so many ways to do it and all of them seem to have drawbacks. When it’s not done well it drives customers nuts.
For an ESP32 + mDash solution, there are several options:
Web App + HTTP
This is the method used by the Smart Light example. Basically the firmware implements a WiFi AP + simple HTTP web server. The user interacts with a publicly-hosted Web App. When time to provision the device, the customer must switch their phone/PC WiFi settings to connect to the device AP network. The Web App then writes WiFi credentials to the device via HTTP and then reads back the device’s public key which is then used to register with mDash (after switching WiFi connections again).
It’s not very user-friendly, but it does work - at least until Chrome implemented their new Private Network Access policy which effectively kills this whole method (as noted in this thread).
I would strongly recommend against this implementation.
This can be much nicer user experience as there are numerous, mature ESP32 libraries that do this quite well. As noted here, mDash adds some complexity as you still need a way to read back the device public key and register it with mDash. Not sure how to do that yet, but if there’s a clean way to do so it could be a good solution as no custom app development would be needed.
BLE holds the promise for a very nice user experience as there is no WiFi switching that often trips up users. Of course this means you need to roll your own BLE-enabled app which may have its own challenges: iOS and Android have their own BLE quirks, nevermind trying to support MacOS or Windows.
Flutter may hold some promise here if you can find a solid & reliable BLE plugin.
SmartConfig (aka ESP-Touch) is a wildcard that holds promise as no BLE is required, nor does it require WiFi switching. Also allows the potential to provision multiple devices at once. The challenge I see is that there are relatively few libraries out there to use with multi-platform frameworks like Ionic or Flutter so building a SmartConfig-enabledapp may not be easy.
Hope this helps!