MQTT with credentials

Your code is not showing if, where and how you are calling client.connect()

A good start for learning how and where to do it would be in the examples provided with the library you're using (there are some variants available).

Assuming you are using this library you'll see a line like this ...

    client.connect("sparkclient");

... in the examples. And given my hint from the other thread ...

... the simple change would be to keep the client-id as-is and merely add the credentials as you chose and the parameter names suggest :wink:
e.g.

  client.connect("yourClientID", "yourUserName", "yourPassPhrase");