Trapping Invalid Auth Code on Connect

I use a lot of identical boards with identical code. The specifics for each installation are stored on the ESP8266 ROM and recovered at boot.The first startup uses an auth code to a setup app that allows SSID, password, Human readable device name, Dallas sensor ID and such.

I connect to the network and then connect to a Blynk private server. One board refused to connect to the Blynk server. I suspected the auth code was invalid and re-enabled BLYNK_PRINT and that was in fact the issue. What I am looking for is a programmatic way to trap the “invalid auth code” returned from the Connect sequence. Right now all I could do is use the setup app auth code if the length of the auth code recovered from ROM was not exactly 32 bytes long.

Anybody know if there is a return error code from the Connect sequence and how to hook it up?

Thanks.

This has been discussed quite a few times in the past. I think the topic that came the nearest to providing a solution was this one:

Maybe with a little more work and possibly tweaking the library files slightly this could work.

The other solution (which is probably the one I’d use) is to make an API call and see if that returned an “Invalid Token” response.
The thing to be aware of is the GEO DNS issue when using the API with the Blynk cloud servers. This means that you have to specify the IP address of the Blynk cloud server in the API call, rather than simply using blynk-cloud.com

Pete.