GoogleCloudPlatform / iot-core-micropython

Apache License 2.0
52 stars 14 forks source link

ESP32 Mqtt exception5 _ not auth. #19

Open reve-engine opened 3 years ago

reve-engine commented 3 years ago

Hi everyone, I was trying restless to publish in IoT core with no results. After running the main.py, the error message appearing is: Creating JWT... JWT: eyJ0eXAiOiAiSldUIiwgImFsZyI6ICJSUzI1NiJ9.eyJleHAiOiAxNjI3ODA2NDU5LCAiYXVkIjogIm... ===================...the key continues....==================== eJ4Zi-zpMILdJavJMsOGQgZkdroFjc-XBEEzx3uFCzEHxftd9fc5PMqZgmwWhbBjX9NvDAmSg==

Traceback (most recent call last): File "", line 98, in File "", line 87, in get_mqtt_client File "/lib/umqtt/simple.py", line 99, in connect MQTTException: 5

Line 98 in main.py: client = get_mqtt_client(config.google_cloud_config['project_id'], config.google_cloud_config['cloud_region'], config.google_cloud_config['registry_id'], config.google_cloud_config['device_id'], jwt)

Line 87 in get_mqtt_client function: client.connect()

Line 99 is related a connect routine inside umqtt.simple.py library, that rise an error:

raise MQTTException(resp[3])

The exception 5 referes to "connection refused, not authorized".

What I have done:

  1. Public_key.pem is in GC registry.
  2. Decode_rsa had been used on Private_key.
  3. I have tried several times with new key pairs generated, with similar results.
  4. If I comment the "rise exception", the program continues but none message is publish in IoT Core.
  5. I have tried with umqtt.simple2 with similar results.

Please give me your support.. I am stuck more than a week on this issue.

Thank you.