Ring: Error: 401 Client Error: Unauthorized for url

Nope still broken :frowning:
Tried with custom_component and without.
Also changed password while I was at it.
Anyone got it working on 0.103.4?

1 Like

103.3 fixed it for most…until today…when it broke again. I’m wondering if Ring is actively breaking non-sanctioned integrations and turning this int a cat and mouse game.

Its failing for me running 0.103.4

I just posted a workaround that I applied to my local HA: https://github.com/tchellomello/python-ring-doorbell/issues/146#issuecomment-568645501

Failing for me on 0.103.4, I had 2FA on, I turned it off and verified it’s off. I also rebooted

2019-12-23 20:27:41 ERROR (SyncWorker_5) [homeassistant.components.ring] Unable to connect to Ring service: 401 Client Error: Unauthorized for url: https://api.ring.com/clients_api/session
2019-12-23 20:27:41 ERROR (MainThread) [homeassistant.setup] Setup failed for ring: Integration failed to initialize.
2019-12-23 20:27:42 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform ring.binary_sensor: Unable to set up component.
2019-12-23 20:27:42 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform ring.camera: Unable to set up component.
2019-12-23 20:28:01 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform ring.sensor: Unable to set up component.

Cheers, worked for me

Same here, was fine for last 2 days but came back. Slightly different this time last time was 403 client error, this time 401 client error.

@tekmaven’s URL fix did the trick for me too :slight_smile:

1 Like

Confirmed direct update via pip worked… Then noticed release 0.103.5 which is for this specifically. Also good.

1 Like

I’m running latest HA container and worked fine. However it failed last night when I rebooted HA with error:

2020-01-10 07:21:47 ERROR (MainThread) [homeassistant.setup] Error during setup of component ring
    raise MissingTokenError(description="Missing access token parameter.")
oauthlib.oauth2.rfc6749.errors.MissingTokenError: (missing_token) Missing access token parameter.
2020-01-10 07:21:48 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform ring.sensor: Unable to set up component.
2020-01-10 07:21:48 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform ring.binary_sensor: Unable to set up component.
2020-01-10 07:21:48 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform ring.camera: Unable to set up component.

It seems a different issue, anyone one has similar? how to fix it?

Thanks!

So in 103.5 it worked, upgraded today to 103.6 and it failed. The error is as above:

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.")
oauthlib.oauth2.rfc6749.errors.MissingTokenError: (missing_token) Missing access token parameter.

saw in another post there is a fix already, but it is github repo.

A temp fix is already in play.

Might be useful to keep the snip-it to grab master if you find yourself falling into the impatient category while it’s being ironed out.

Here’s my version in case it’s useful for others.

cd /tmp/
wget https://github.com/tchellomello/python-ring-doorbell/archive/master.zip
unzip master.zip
docker cp python-ring-doorbell-master/ring_doorbell homeassistant:/usr/local/lib/python3.7/site-packages/
docker restart homeassistant

If you want to try out other commits. (For HA, 0.103.5/0.103.6)

commit="3348afdaab74ca55f01018bf9e19e61a815738ee"
wget https://github.com/tchellomello/python-ring-doorbell/archive/$commit.zip
unzip $commit.zip
docker cp python-ring-doorbell-$commit/ring_doorbell homeassistant:/usr/local/lib/python3.7/site-packages/
docker restart homeassistant

To switch back to homeassistant’s version (reinstall via requirement of manifest)

docker exec -it homeassistant python3 -m pip uninstall --yes ring_doorbell
docker restart homeassistant

Or update to next HA version when available. (Best option)

3 Likes

which one is currently working? tried master.zip still error out.

Its not yet in the main stream
In your hassio/system
Join the beta channel
restart
You should see 104.0b3 as being available

1 Like

So I upgraded to 104 and removed the stuff from my config. Multiple restarts but still no luck getting it set back up. I don’t have a pickle file.

[2020-01-16 13:40:55 ERROR (MainThread) [homeassistant.components.ring.config_flow] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/ring/config_flow.py", line 45, in async_step_user
    token = await validate_input(self.hass, user_input)
  File "/usr/src/homeassistant/homeassistant/components/ring/config_flow.py", line 22, in validate_input
    auth.fetch_token, data["username"], data["password"], data.get("2fa"),
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/ring_doorbell/auth.py", line 40, in fetch_token
    headers=headers,
  File "/usr/local/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 244, 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 411, 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 379, in parse_token_response
    validate_token_parameters(params)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 386, in validate_token_parameters
    raise_from_error(params.get('error'), params)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 415, in raise_from_error
    raise cls(**kwargs)
oauthlib.oauth2.rfc6749.errors.UnauthorizedClientError: (unauthorized_client) The client is not authorized to request a token using this method.

Hassio system:

arch	armv7l
dev	false
docker	true
hassio	true
os_name	Linux
python_version	3.7.6
timezone	Europe/London
version	0.104.0
virtualenv	false

Did you have it setup up as a custom component,
Did you download the ring doorbell library to your config folder ?
Is so to any of the above remove them

I have this same issue, did not do a custom component and did not load the library. This seems to me that there’s a refresh token somewhere that is being used but ring doesn’t like it. Need to reset the component to go through the original auth with no existing refresh token.