Handle on Invalid token!

The code you have provided would not connect to anything.

Please provide the part of your code that makes the connection and indicate how you are calling the function to read / set the new SSID.