core: 0.103.6 Ring OAuth Broken Again

Home Assistant release with the issue:

0.103.6

Last working Home Assistant release (if known):

0.103.5

Operating environment (Hass.io/Docker/Windows/etc.):

Docker

Integration:

https://www.home-assistant.io/integrations/ring

Description of problem:

Ring devices don’t load on startup and there is an OAuth related exception in the logs

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):


Traceback (if applicable):

2020-01-09 15:11:17 ERROR (MainThread) [homeassistant.setup] Error during setup of component ring
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 176, in _async_setup_component
    component.setup, hass, processed_config  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/ring/__init__.py", line 55, in setup
    ring = Ring(username=username, password=password, cache_file=cache)
  File "/usr/local/lib/python3.7/site-packages/ring_doorbell/__init__.py", line 62, in __init__
    self._process_cached_session()
  File "/usr/local/lib/python3.7/site-packages/ring_doorbell/__init__.py", line 91, in _process_cached_session
    req = self.query(url, raw=True)
  File "/usr/local/lib/python3.7/site-packages/ring_doorbell/__init__.py", line 198, in query
    'Bearer {}'.format(self._get_oauth_token())
  File "/usr/local/lib/python3.7/site-packages/ring_doorbell/__init__.py", line 111, in _get_oauth_token
    self.auth = oauth.refresh_tokens()
  File "/usr/local/lib/python3.7/site-packages/ring_doorbell/auth.py", line 59, in refresh_tokens
    token = self._oauth.refresh_token(OAuth.ENDPOINT)
  File "/usr/local/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 446, in refresh_token
    self.token = self._client.parse_request_body_response(r.text, scope=self.scope)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 421, in parse_request_body_response
    self.token = parse_token_response(body, scope=scope)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 431, in parse_token_response
    validate_token_parameters(params)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 441, in validate_token_parameters
    raise MissingTokenError(description="Missing access token parameter.")

Additional information:

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 15
  • Comments: 26 (7 by maintainers)

Most upvoted comments

Yep. Same thing here, thought I misconfigured something.

Home Assistant release with the issue: 0.103.6

Last working Home Assistant release (if known): 0.103.6

Operating environment (Hass.io/Docker/Windows/etc.): Hass.io on Ubuntu VM in VirtualBox

2020-01-09 16:11:51 ERROR (MainThread) [homeassistant.setup] Error during setup of component ring
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 176, in _async_setup_component
    component.setup, hass, processed_config  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/ring/__init__.py", line 55, in setup
    ring = Ring(username=username, password=password, cache_file=cache)
  File "/usr/local/lib/python3.7/site-packages/ring_doorbell/__init__.py", line 62, in __init__
    self._process_cached_session()
  File "/usr/local/lib/python3.7/site-packages/ring_doorbell/__init__.py", line 98, in _process_cached_session
    self._authenticate()
  File "/usr/local/lib/python3.7/site-packages/ring_doorbell/__init__.py", line 128, in _authenticate
    'Bearer {}'.format(self._get_oauth_token())
  File "/usr/local/lib/python3.7/site-packages/ring_doorbell/__init__.py", line 109, in _get_oauth_token
    self.auth_callback)
  File "/usr/local/lib/python3.7/site-packages/ring_doorbell/auth.py", line 28, in fetch_token
    return self.__fetch_token(username, password)
  File "/usr/local/lib/python3.7/site-packages/ring_doorbell/auth.py", line 55, in __fetch_token
    scope=OAuth.SCOPE)
  File "/usr/local/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 360, in fetch_token
    self._client.parse_request_body_response(r.text, scope=self.scope)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 421, in parse_request_body_response
    self.token = parse_token_response(body, scope=scope)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 431, in parse_token_response
    validate_token_parameters(params)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 441, in validate_token_parameters
    raise MissingTokenError(description="Missing access token parameter.")
oauthlib.oauth2.rfc6749.errors.MissingTokenError: (missing_token) Missing access token parameter.
2020-01-09 16:11:51 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform ring.binary_sensor: Unable to set up component.
2020-01-09 16:11:51 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform ring.camera: Unable to set up component.
2020-01-09 16:11:57 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform ring.sensor: Unable to set up component.

How did you add them?

Nothing special, just added the integration. Of course now I’m getting the following in my logs:

2020-01-12 21:32:15 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ring_front_door_last_ding_2 fails
Traceback (most recent call last):
  File "/opt/home-assistant/lib64/python3.7/site-packages/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/opt/home-assistant/lib64/python3.7/site-packages/homeassistant/helpers/entity.py", line 461, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/lib64/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/opt/home-assistant/lib64/python3.7/site-packages/homeassistant/components/ring/sensor.py", line 199, in update
    limit=5, timezone=self._tz, kind=self._kind, enforce_limit=True
  File "/opt/home-assistant/lib64/python3.7/site-packages/ring_doorbell/doorbot.py", line 221, in history
    response = self._ring.query(url, extra_params=params).json()
  File "/opt/home-assistant/lib64/python3.7/site-packages/ring_doorbell/__init__.py", line 40, in query
    return self.auth.query(url, method, extra_params, json, timeout)
  File "/opt/home-assistant/lib64/python3.7/site-packages/ring_doorbell/auth.py", line 95, in query
    req.raise_for_status()
  File "/opt/home-assistant/lib64/python3.7/site-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.ring.com/clients_api/doorbots/19131377/history?api_version=9&limit=40

Seems someone reached out to Ring and got a response from the CTO.

https://github.com/home-assistant/home-assistant/issues/30076#issuecomment-572913756

Hopefully, work on PR #30564 will solve this once and for all. Can’t really blame Ring; they’re trying to fix long time security issues on their end at least.