Mqtt simple setting credentials from variable instead of the "MQTT_UTF8_LITERAL" function

Hi, I'm new to C, but I have made an application based on mqtt_simple that does what I want. 

Now I would like to set the credentials from a variable that I have generated, but I can't seem to get it right. 

The Variables passW and userId is defined at the top:

uint8_t* passW[100];
uint8_t* userId[100];
And then I have a function that generates in this case "test123". I have off course tested that test123 is a valid mqtt user and password. 
Its probably the way I set client->password and client->user_name that's the issue here, any ideas? I'm a C nooby so any help would be much appreciated. 

This is the code I have in client_init:

/* MQTT client configuration */
client->broker = &broker;
client->evt_cb = mqtt_evt_handler;
client->client_id.utf8 = client_id_get();
client->client_id.size = strlen(client->client_id.utf8);

client->password = (struct mqtt_utf8 *) passW;
client->user_name = (struct mqtt_utf8 *) userId;
LOG_DBG("USERID = '%s'", client->user_name);
LOG_DBG("PASSWO = '%s'", client->password);

It outputs:

[00:00:03.111,633] <dbg> mqtt_simple: client_init: USERID = 'test123'

[00:00:03.111,633] <dbg> mqtt_simple: client_init: PASSWO = 'test123'
[00:00:03.111,663] <inf> mqtt_simple: TLS enabled

[00:00:12.363,342] <err> mqtt_simple: mqtt_connect -12

Related