Closed
Description
Describe the issue
After generated keys with the script (/iot/api-client/generate_keys.sh
), created a registry, a device (and pushed the content of the file rsa_cert.pem
), and a subscription, I try to push MQTT messages with the code example given in the folder iot/api-client/manager
. But I have got a Not authorized to connect
error:
mvn exec:java Dexec.mainClass="com.example.cloud.iot.examples.MqttExample" \
-Dexec.args="-project_id=myproject \
-registry_id=myregistry \
-device_id=mydevice \
-private_key_file=../rsa_private_pkcs8 \
-algorithm=RS256"
...
[INFO] --- exec-maven-plugin:1.6.0:java (default-cli) @ cloudiot-manager-demo ---
An error occurred: Not authorized to connect
[WARNING]
org.eclipse.paho.client.mqttv3.MqttSecurityException: Not authorized to connect
at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException (ExceptionHelper.java:28)
at org.eclipse.paho.client.mqttv3.internal.ClientState.notifyReceivedAck (ClientState.java:988)
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run (CommsReceiver.java:145)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201 (ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run (ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
at java.lang.Thread.run (Thread.java:748)
It works with the Python and NodeJS example codes (with the right privacy key).
Did I do something wrong?
PS: Also tried the keys in the repository w/o success.
Thanks.
Metadata
Metadata
Assignees
Labels
No labels