ring icon indicating copy to clipboard operation
ring copied to clipboard

Unable to authenticate with Ring servers

Open risograph opened this issue 3 years ago • 8 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Describe The Bug

I have generated a refreshtoken successfully with the CLI tool and now when starting homebridge the ring plugin remains non-functional because the token is invalid according to an error in the logs.

To Reproduce

use homebridge-nest 11.8.1 start homebridge gui x 1.6.0 view logs 406 error after booting nest plugin

Expected behavior

honestly not sure bc i havent gotten there yet. i assume my connected devices would appear without error.

Relevant log output

[8/7/2023, 9:29:19 AM] [Ring] HTTPError: Response code 406 (Not Acceptable)
    at Request.<anonymous> (/homebridge/node_modules/homebridge-ring/node_modules/got/dist/source/as-promise/index.js:118:42)
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_NON_2XX_3XX_RESPONSE',
  timings: {
    start: 1691364554493,
    socket: 1691364554595,
    lookup: 1691364554597,
    connect: 1691364555096,
    secureConnect: 1691364557895,
    upload: 1691364559497,
    response: 1691364559695,
    end: 1691364559793,
    error: undefined,
    abort: undefined,
    phases: {
      wait: 102,
      dns: 2,
      tcp: 499,
      tls: 2799,
      request: 1602,
      firstByte: 198,
      download: 98,
      total: 5300
    }
  }
}
[8/7/2023, 9:29:19 AM] [Ring] Request to https://api.ring.com/devices/v1/locations failed:
[8/7/2023, 9:29:19 AM] [Ring] Error: Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
    at RingRestClient.getGrantData (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/rest-client.js:140:15)
    at RingRestClient.getAuth (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/rest-client.js:143:32)
    at RingRestClient.getAuth (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/rest-client.js:184:29)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[8/7/2023, 9:29:19 AM] [Ring] Error connecting to API
[8/7/2023, 9:29:19 AM] [Ring] Error: Refresh token is not valid.  Unable to authenticate with Ring servers.  See https://github.com/dgreif/ring/wiki/Refresh-Tokens
    at RingRestClient.getGrantData (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/rest-client.js:140:15)
    at RingRestClient.getAuth (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/rest-client.js:143:32)
    at RingRestClient.getAuth (/homebridge/node_modules/homebridge-ring/node_modules/ring-client-api/lib/rest-client.js:184:29)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Screenshots

No response

Homebridge Ring Config

{
    "refreshToken": "xxxxx",
    "platform": "Ring"
}

Additional context

No response

OS

macOS Ventura

Node.js Version

v20.4.0

NPM Version

v9.7.2?

Homebridge/HOOBs Version

v1.6.0

Homebridge Ring Plugin Version

11.8.1

Operating System

Docker

risograph avatar Aug 06 '23 23:08 risograph

Perhaps obvious but, as a general rule, if the API responds that the token is invalid, then it's because the token is invalid. If you just generated it, then that would indicate that there was a copy/paste error (commonly the unintentional insertion of line breaks since the token is very long) or some other issue with how the token was placed into the configuration. Other options include temporary Ring outages (they happen), or Ring has changed something and broken authentication completely, however, that latter issue would usually be followed by a significant number of reports in very short order.

You might consider using one of the UI based options for generating a token to avoid any potential copy/paste issues.

tsightler avatar Aug 07 '23 00:08 tsightler

406 in particular can also mean that you are being rate limited. If this occurs, you simply need to wait a bit (e.g. a few hours) and try again. This doesn't happen often, but can occur if you try to log in many times in a row.

dgreif avatar Aug 07 '23 15:08 dgreif

Similar experience.... But possibly something different

Have added both the Doorbell Cam and the Spotlight Cam to a Ring Chime Pro 2nd Gen because of the weak WiFi signal I was getting. Fixes the problem completely for the cameras using the Ring App....but not Homebridge won't connect

Logs here....Tried manually updating token

[8/10/2023, 3:19:08 PM] Homebridge v1.6.1 (HAP v0.11.1) (Homebridge 5A20) is running on port 51219. [8/10/2023, 3:19:08 PM] [Ring] Found the following locations: [8/10/2023, 3:19:08 PM] [Ring] locationId: 757b30a6-c02f-4eb0-b7f4-b8b11131bf60 - Virginia Beach [8/10/2023, 3:19:08 PM] [Ring] 404 from endpoint https://api.ring.com/clients_api/doorbots/19321427/motions_subscribe [8/10/2023, 3:19:08 PM] [Ring] Session hardware_id not found. Creating a new session and trying again. [8/10/2023, 3:19:08 PM] [Ring] 404 from endpoint https://api.ring.com/clients_api/doorbots/25143315/subscribe [8/10/2023, 3:19:08 PM] [Ring] Session hardware_id not found. Creating a new session and trying again. [8/10/2023, 3:19:08 PM] [Ring] 404 from endpoint https://api.ring.com/clients_api/doorbots/19321427/subscribe [8/10/2023, 3:19:08 PM] [Ring] Session hardware_id not found. Creating a new session and trying again. [8/10/2023, 3:19:08 PM] [Ring] 404 from endpoint https://api.ring.com/clients_api/doorbots/25143315/motions_subscribe [8/10/2023, 3:19:08 PM] [Ring] Session hardware_id not found. Creating a new session and trying again. [8/10/2023, 3:19:08 PM] [Ring] Configuring 2 cameras and 3 devices for location "Virginia Beach" - locationId: 757b30a6-c02f-4eb0-b7f4-b8b11131bf60 [8/10/2023, 3:19:08 PM] [Ring] Adding new accessory 2fd2c5cf-da57-4c88-9df0-6b92cf026341 chime_pro_v2 Garage [8/10/2023, 3:21:07 PM] [Ring] Preparing Live Stream for Front Door [8/10/2023, 3:21:07 PM] [Ring] Stream Prepared for Front Door (0.286s) [8/10/2023, 3:21:08 PM] [Ring] Activating stream for Front Door (0.356s) [8/10/2023, 3:21:08 PM] [Ring] iceConnectionStateChange: completed [8/10/2023, 3:21:08 PM] [Ring] RangeError: offset is out of bounds at Uint8Array.set () at Function.padStart (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:972:13) at Function.encodeSignature (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:940:22) at Function.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/webcrypto/build/webcrypto.js:1575:54) at EcdsaProvider.onSign (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/webcrypto/build/webcrypto.js:1737:25) at EcdsaProvider.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:157:28) at SubtleCrypto.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:1405:39) at Function.create (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/x509/build/x509.cjs.js:2407:35) at Function.value [as createSelfSignedCertificateWithKey] (/usr/local/lib/node_modules/homebridge-ring/node_modules/dtls/src/context/cipher.ts:108:18) at RTCDtlsTransport.setupCertificate (/usr/local/lib/node_modules/homebridge-ring/node_modules/werift/src/transport/dtls.ts:76:9) [8/10/2023, 3:21:08 PM] [Ring] connectionStateChange: closed [8/10/2023, 3:21:08 PM] [Ring] iceConnectionStateChange: closed [8/10/2023, 3:21:09 PM] [Ring] Failed to activate stream [8/10/2023, 3:21:09 PM] [Ring] RangeError: offset is out of bounds at Uint8Array.set () at Function.padStart (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:972:13) at Function.encodeSignature (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:940:22) at Function.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/webcrypto/build/webcrypto.js:1575:54) at EcdsaProvider.onSign (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/webcrypto/build/webcrypto.js:1737:25) at EcdsaProvider.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:157:28) at SubtleCrypto.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:1405:39) at Function.create (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/x509/build/x509.cjs.js:2407:35) at Function.value [as createSelfSignedCertificateWithKey] (/usr/local/lib/node_modules/homebridge-ring/node_modules/dtls/src/context/cipher.ts:108:18) at RTCDtlsTransport.setupCertificate (/usr/local/lib/node_modules/homebridge-ring/node_modules/werift/src/transport/dtls.ts:76:9) [8/10/2023, 3:21:22 PM] [Ring] Preparing Live Stream for Front [8/10/2023, 3:21:22 PM] [Ring] Stream Prepared for Front (0.127s) [8/10/2023, 3:21:22 PM] [Ring] Activating stream for Front (0.158s) [8/10/2023, 3:21:22 PM] [Ring] iceConnectionStateChange: completed [8/10/2023, 3:21:22 PM] [Ring] RangeError: offset is out of bounds at Uint8Array.set () at Function.padStart (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:972:13) at Function.encodeSignature (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:940:22) at Function.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/webcrypto/build/webcrypto.js:1575:54) at EcdsaProvider.onSign (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/webcrypto/build/webcrypto.js:1737:25) at EcdsaProvider.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:157:28) at SubtleCrypto.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:1405:39) at Function.create (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/x509/build/x509.cjs.js:2407:35) at Function.value [as createSelfSignedCertificateWithKey] (/usr/local/lib/node_modules/homebridge-ring/node_modules/dtls/src/context/cipher.ts:108:18) at RTCDtlsTransport.setupCertificate (/usr/local/lib/node_modules/homebridge-ring/node_modules/werift/src/transport/dtls.ts:76:9) [8/10/2023, 3:21:22 PM] [Ring] connectionStateChange: closed [8/10/2023, 3:21:22 PM] [Ring] iceConnectionStateChange: closed [8/10/2023, 3:21:22 PM] [Ring] Failed to activate stream [8/10/2023, 3:21:22 PM] [Ring] RangeError: offset is out of bounds at Uint8Array.set () at Function.padStart (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:972:13) at Function.encodeSignature (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:940:22) at Function.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/webcrypto/build/webcrypto.js:1575:54) at EcdsaProvider.onSign (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/webcrypto/build/webcrypto.js:1737:25) at EcdsaProvider.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:157:28) at SubtleCrypto.sign (/usr/local/lib/node_modules/homebridge-ring/node_modules/webcrypto-core/build/webcrypto-core.js:1405:39) at Function.create (/usr/local/lib/node_modules/homebridge-ring/node_modules/@peculiar/x509/build/x509.cjs.js:2407:35) at Function.value [as createSelfSignedCertificateWithKey] (/usr/local/lib/node_modules/homebridge-ring/node_modules/dtls/src/context/cipher.ts:108:18) at RTCDtlsTransport.setupCertificate (/usr/local/lib/node_modules/homebridge-ring/node_modules/werift/src/transport/dtls.ts:76:9)

johnrr70 avatar Aug 10 '23 18:08 johnrr70

@johnrr70 please see #1286 for your specific issue. I'm going to hide your comment as it's a bit off topic for this issue, but you are welcome to post on #1286 where I've asked users to provide some specific data to help us narrow the problem down.

dgreif avatar Aug 13 '23 20:08 dgreif

I've just had this, however the error was due to using a VPN on my computer. I couldn't even get onto Ring's website. I know they don't like VPN's. Once turned off I had no issue. Do you have a VPN turned on?

PeterLawrence1 avatar Aug 14 '23 15:08 PeterLawrence1

I don't have a VPN running.

Did you have the VPN running on the Homebridge or on the client side?

I've just had this, however the error was due to using a VPN on my computer. I couldn't even get onto Ring's website. I know they don't like VPN's. Once turned off I had no issue. Do you have a VPN turned on?

DerMuri avatar Aug 14 '23 15:08 DerMuri

I have Homebridge installed on my Mac

PeterLawrence1 avatar Aug 14 '23 15:08 PeterLawrence1

Haven't heard back from @risograph, so I'm going to close this and assume it was rate limiting related.

dgreif avatar Aug 20 '23 18:08 dgreif