tsightler / ring-mqtt

Ring devices to MQTT Bridge
MIT License
574 stars 103 forks source link

Bug: Refresh token is not valid (since upgrade to 2022.10) #477

Closed lyonsbt closed 1 year ago

lyonsbt commented 1 year ago

Describe the Bug

Entities are unavailable due to authentication issue with Ring servers

Steps to Reproduce

Refresh token has been refreshed on multiple occasions / server restarted but with no change

Expected Behavior

MQTT entities available

Log Output

2022-10-10T12:33:04.938Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:33:24.939Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:33:44.952Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:34:04.955Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:34:24.958Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:34:44.960Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:35:04.961Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:35:24.961Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:35:44.962Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:35:47.074Z ring-rtsp INF [RTSP] [conn xxxx] opened
2022-10-10T12:35:47.077Z ring-rtsp INF [RTSP] [conn xxxx] opened
2022-10-10T12:35:47.082Z ring-rtsp INF [path xxxxc_live] runOnDemand command started
2022-10-10T12:35:47.085Z ring-rtsp INF [path xxxx_live] runOnDemand command started
2022-10-10T12:35:47.092Z ring-rtsp [Front Door] Sending command to activate live stream ON-DEMAND
2022-10-10T12:35:47.096Z ring-rtsp [Garden] Sending command to activate live stream ON-DEMAND
2022-10-10T12:35:47.140Z ring-mqtt [Garden] Received set live stream state ON-DEMAND
2022-10-10T12:35:47.140Z ring-mqtt [Front Door] Received set live stream state ON-DEMAND
2022-10-10T12:35:57.082Z ring-rtsp INF [path xxxx_live] runOnDemand command stopped
2022-10-10T12:35:57.083Z ring-rtsp [Front Door] Deactivating live stream due to signal from RTSP server (no more active clients or publisher ended stream)
2022-10-10T12:35:57.086Z ring-rtsp INF [RTSP] [conn xxxx] closed (source of path 'xxxxc_live' has timed out)
2022-10-10T12:35:57.087Z ring-rtsp INF [path xxxx_live] runOnDemand command stopped
2022-10-10T12:35:57.088Z ring-rtsp INF [RTSP] [conn xxxx] closed (source of path 'xxxx_live' has timed out)
2022-10-10T12:35:57.089Z ring-rtsp [Garden] Deactivating live stream due to signal from RTSP server (no more active clients or publisher ended stream)
2022-10-10T12:35:57.100Z ring-mqtt [Front Door] Received set live stream state OFF
2022-10-10T12:35:57.101Z ring-mqtt [Front Door] Stopping live stream session on workerId 2
2022-10-10T12:35:57.106Z ring-mqtt [Garden] Received set live stream state OFF
2022-10-10T12:35:57.106Z ring-mqtt [Garden] Stopping live stream session on workerId 1
2022-10-10T12:36:04.962Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:36:24.963Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:36:44.963Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:37:04.965Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:37:24.981Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:37:44.981Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:38:04.982Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:38:24.986Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:38:44.999Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:39:05.002Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:39:25.003Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:39:45.016Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:40:05.019Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:40:25.036Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:40:45.049Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:41:05.051Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:41:25.069Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:41:45.081Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:42:05.082Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:42:25.085Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
2022-10-10T12:42:45.093Z ring-mqtt Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens

Screenshots

No response

Config File

I can provide this if you require extra information to the above log output

Install Type

Home Assistant Addon

Version

2022.10.02 of OS, 5.0.3 of add-on

Operating System

Home Assistant OS

Architecture

N/A

Machine Details

Raspberry Pi

tsightler commented 1 year ago

Refresh token has been refreshed on multiple occasions / server restarted but with no change

You state this, but it doesn't match the logs you provided. Also, when you say the "server was restarted" what exactly did you do?

lyonsbt commented 1 year ago

Apologies, I have refreshed the token multiple times over several days, but not during the period of those logs today - not overly helpful, I know.

I've just refreshed the token again, however, and below are the relevant logs:

2022-10-10T13:26:25.995Z ring-mqtt Refresh token is not valid. Unable to authenticate with Ring servers. See https://github.com/dgreif/ring/wiki/Refresh-Tokens 2022-10-10T13:26:43.296Z ring-mqtt Username/Password was accepted, waiting for 2FA code to be entered. 2022-10-10T13:26:45.998Z ring-mqtt Refresh token is not valid. Unable to authenticate with Ring servers. See https://github.com/dgreif/ring/wiki/Refresh-Tokens 2022-10-10T13:26:55.399Z ring-mqtt Attempting connection to Ring API using generated refresh token... 2022-10-10T13:26:56.080Z ring-mqtt Successfully established connection to Ring API using generated token 2022-10-10T13:26:56.081Z ring-mqtt Received updated refresh token 2022-10-10T13:26:56.081Z ring-mqtt Saving updated refresh token to state file 2022-10-10T13:26:57.096Z ring-mqtt Successfully saved updated state file: /data/ring-state.json 2022-10-10T13:27:06.000Z ring-mqtt Refresh token is not valid. Unable to authenticate with Ring servers. See https://github.com/dgreif/ring/wiki/Refresh-Tokens

In terms of restarting, I only mean restarting my HA instance on the Raspberry Pi.

Thanks,

Brad

tsightler commented 1 year ago

Have you actually restarted the addon? The logs don't look like you have.

lyonsbt commented 1 year ago

Apologies for wasting your time - I've specifically restarted the addon and everything is connected fine now. I didn't think of that because I restarted my HA instance earlier today without any change.

In any case, thanks for your work / support on this add-on - much appreciated

tsightler commented 1 year ago

Restarting HA doesn't restart addons. HA runs in its own container and, when you use the restart from the system menu it only restarts this container, addon containers aren't restarted. This is why I asked specifically what restart method you used, in my opinion, it's very misleading and it seems to trip people up regularly because they think this is a full restart. It is possible to fully restart the system from the HA UI, but you have to go to hardware and choose the 3-dots menu and select restart system, which will before an actual reboot of the hardware.

However, in the end, it still indicates that there is a bug I need to look into because regenerating the token should work without requiring a restart of the addon so I'll need to find time to look at this at some point.