This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

mqtt_simple sample adding username and password credentials

Hi,

I am trying to connect to cloud MQTT (cute cat) which needs username and password for authentication. In the sample the password and username is set to NULL in client_init:

client->password = NULL;
client->user_name = NULL;

I have edited prj.conf and Kconfig to add my password and username definitions in this format:

CONFIG_MQTT_BROKER_PASSWORD="password"
CONFIG_MQTT_BROKER_USERNAME="username"

but I can't figure out how to assign them in the code. Have someone successfully done this, if so what must be done?

Kind regards

Samuel

Related