Change WiFi password by access point (Arduino IOT cloud project)

Yeah, this is a real issue. I also want to use the SmartConfig app. to configure WIFI on the fly. I really don't get why all samples use fixed WIFI credentials. This is hardly a real scenario.

I tried to move all code from the secret file inside the main sketch but it complains about a class member.