4

I'm trying to connect my Arduino with ethernet to Xively using their MQTT server but am having trouble authenticating. When I do client.connect("arduinoMQTT") I get a failure. I tried passing my API Key as a username by doing client.connect("arduinoMQTT", "APIKEY") but then the code won't compile.

How can I authenticate to the Xively MQTT server on arduino.

calumb
  • 1,051
  • 2
  • 10
  • 24

1 Answers1

6

If you check the api docs for the Arduino MQTT client, you'll see you need to provide a password argument as well as the username. When connecting to Xively, you use your api key as username and null for the password:

client.connect("arduinoMQTT", "APIKEY",null)

You should probably use something a bit more unique than arduinoMQTT as the client id as well.

knolleary
  • 9,777
  • 2
  • 28
  • 35