-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cloud IoT Core: mqtt: SERVER:The authorization token expired. #1264
Comments
@gguuss can you take a look? |
Yup, I was seeing strange things from the console last week as well. |
I'm guessing that you're not refreshing the JWT after 3600 seconds. @mkahn5 do you have code similar to the following that is executing:
|
@gguuss Nope, I was unaware of the JWT expiration. I can try that snip see if it works. Maybe I missed the JWT refresh in the quickstart example. |
@gguuss Couldnt find any documentation on refreshing JWT for cloud iot core. Can you make a pull request on my project? https://github.com/mkahn5/iot-projects/blob/master/raspberrypi_temp_monitor_cloud_iot/temp_monitor.py |
Done, let me know if the PR helps! |
@mkahn5 I'm not sure I've seen this error before - is this happening after a duration of time or are you seeing it at random? |
@gguuss Deleted comment in thread, error was from another device. Will provide feedback on the PR and JWT refresh soon. Thanks :) |
In which file did you encounter the issue?
https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/iot/api-client/mqtt_example/cloudiot_mqtt_example.py
and my version on:
https://github.com/mkahn5/iot-projects/blob/master/RaspberryPi_Thermostat_Cloud_IoT/pubsub_thermostat_f10.py
Did you change the file? If so, how?
Just changed the payload in my version, https://github.com/mkahn5/iot-projects/blob/master/RaspberryPi_Thermostat_Cloud_IoT/pubsub_thermostat_f10.py
Describe the issue
After the script is running for awhile I will receive the error mqtt: SERVER:The authorization token expired. in Cloud IoT core. The script is only publishing every 120 seconds to PubSub. It will resolve itself over time, sometimes it does not. How long does the MQTT token last for?
Here is the script failing then recovering:
Publishing payload {"temp": 68.0, "time": "12/10/2017 13:17:41 PST"}
Connection Result: 4: The client is not currently connected.
Disconnected: 5: The connection was refused.
Publishing payload {"temp": 68.0, "time": "12/10/2017 13:19:41 PST"}
Connection Result: 4: The client is not currently connected.
Disconnected: 5: The connection was refused.
Creating JWT using RS256 from private key file rsa_private.pem
Connection Result: 0: No error.
Publishing payload {"temp": 68.0, "time": "12/10/2017 13:21:42 PST"}
Subscribed: (1,)
Received message '' on topic '/devices/temphome/config' with Qos 1
Published message acked, sleeping 120 sec
Publishing payload {"temp": 68.0, "time": "12/10/2017 13:23:42 PST"}
Published message acked, sleeping 120 sec
Publishing payload {"temp": 68.0, "time": "12/10/2017 13:25:43 PST"}
Published message acked, sleeping 120 sec
Publishing payload {"temp": 68.0, "time": "12/10/2017 13:27:43 PST"}
Published message acked, sleeping 120 sec
Publishing payload {"temp": 68.0, "time": "12/10/2017 13:29:43 PST"}
The text was updated successfully, but these errors were encountered: