Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Using mosquitto C client for token based authentication with MQTT broker

Hello Nicholas,

Thanks for reply. Yes, I did use  mosquitto_username_pw_set to set password and token as mentioned in their document. However, it is not working. 
I tried printing logs as well. Only Connect log was printed, not receiving CONNACK as well. 

I compared this implementation with Paho C Client api, where username and password is passed at the time of client connection, there they have used a flag 'useSSL' as true. I am trying to figure out equivalent for the same in mosquito C library apis. I came across mosquitto_tls_opts_set api. So I am wondering if I am missing any configuration here.

Thanks & Regards,
Supriya Jagtap

On Tue, Apr 24, 2018 at 8:57 PM, Nicholas Humfrey <njh@xxxxxxxxxx> wrote:
Hi,

I haven't used Watson IOT before but found this documentation page:

https://console.bluemix.net/docs/services/IoT/devices/mqtt.html#mqtt


User name: The user name is the same value for all devices: use-token-auth. This value causes Watson IoT Platform to use the device's authentication token, which is specified as the password.

Password: The password for each device is the unique authentication token that was generated when the device was registered with Watson IoT Platform.


So based on that the code should look something like this:

    mosquitto_username_pw_set(mosq, "use-token-auth", token);


nick.



On 2018-04-24 12:33, Supriya Jagtap wrote:
Hi,

I would like to know if token based authentication is possible with
mosquitto c client library api and how?

I went through api documentation and came across
mosquitto_username_pw_set and mosquitto_tls_opts_set. I tried setting
username password and TLS options, but couldn't connect to the MQTT
broker (IBM Watson IOT service).

Am I missing anything here?

Thanks & Regards,
Supriya Jagtap
_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mosquitto-dev


Back to the top