python-ring-doorbell icon indicating copy to clipboard operation
python-ring-doorbell copied to clipboard

MissingTokenError

Open legendarylion opened this issue 3 years ago • 15 comments

Yo. Getting the following today when refreshing the token - even from a pull of the latest branch. Anyone else?

Traceback (most recent call last): File "E:\homestead_projects\python-ring-doorbell-0.6.2\test.py", line 29, in main auth.fetch_token(username, password) File "E:\homestead_projects\python-ring-doorbell-0.6.2\ring_doorbell\auth.py", line 41, in fetch_token token = self.oauth.fetch_token( File "C:\Users_\AppData\Local\Programs\Python\Python39\lib\site-packages\requests_oauthlib-1.3.0-py3.9.egg\requests_oauthlib\oauth2_session.py", line 360, in fetch_token self.client.parse_request_body_response(r.text, scope=self.scope) File "C:\Users_\AppData\Local\Programs\Python\Python39\lib\site-packages\oauthlib-3.1.0-py3.9.egg\oauthlib\oauth2\rfc6749\clients\base.py", line 421, in parse_request_body_response self.token = parse_token_response(body, scope=scope) File "C:\Users_\AppData\Local\Programs\Python\Python39\lib\site-packages\oauthlib-3.1.0-py3.9.egg\oauthlib\oauth2\rfc6749\parameters.py", line 431, in parse_token_response validate_token_parameters(params) File "C:\Users_\AppData\Local\Programs\Python\Python39\lib\site-packages\oauthlib-3.1.0-py3.9.egg\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.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "E:\homestead_projects\python-ring-doorbell-0.6.2\test.py", line 49, in main() File "E:\homestead_projects\python-ring-doorbell-0.6.2\test.py", line 31, in main auth.fetch_token(username, password, otp_callback()) File "E:\homestead_projects\python-ring-doorbell-0.6.2\ring_doorbell\auth.py", line 41, in fetch_token token = self.oauth.fetch_token( File "C:\Users_\AppData\Local\Programs\Python\Python39\lib\site-packages\requests_oauthlib-1.3.0-py3.9.egg\requests_oauthlib\oauth2_session.py", line 360, in fetch_token self.client.parse_request_body_response(r.text, scope=self.scope) File "C:\Users_\AppData\Local\Programs\Python\Python39\lib\site-packages\oauthlib-3.1.0-py3.9.egg\oauthlib\oauth2\rfc6749\clients\base.py", line 421, in parse_request_body_response self.token = parse_token_response(body, scope=scope) File "C:\Users_\AppData\Local\Programs\Python\Python39\lib\site-packages\oauthlib-3.1.0-py3.9.egg\oauthlib\oauth2\rfc6749\parameters.py", line 431, in parse_token_response validate_token_parameters(params) File "C:\Users_\AppData\Local\Programs\Python\Python39\lib\site-packages\oauthlib-3.1.0-py3.9.egg\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.

legendarylion avatar Jul 02 '21 14:07 legendarylion

Same here...

Traceback (most recent call last): File "./test.py", line 63, in main() File "./test.py", line 43, in main auth.fetch_token(username, password, otp_callback()) File "/usr/local/lib/python3.7/dist-packages/ring_doorbell/auth.py", line 40, in fetch_token headers=headers, File "/usr/local/lib/python3.7/dist-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/dist-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/dist-packages/oauthlib/oauth2/rfc6749/parameters.py", line 431, in parse_token_response validate_token_parameters(params) File "/usr/local/lib/python3.7/dist-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.

dlemmink avatar Jul 02 '21 16:07 dlemmink

Getting the same error as well:

File "ring_floodlight.py", line 46, in main auth.fetch_token(username, password) File "/srv/dev/lib/python/ring_doorbell/auth.py", line 35, in fetch_token token = self._oauth.fetch_token( File "/usr/local/lib/python3.8/dist-packages/requests_oauthlib/oauth2_session.py", line 360, in fetch_token self._client.parse_request_body_response(r.text, scope=self.scope) File "/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 421, in parse_request_body_response self.token = parse_token_response(body, scope=scope) File "/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/parameters.py", line 431, in parse_token_response validate_token_parameters(params) File "/usr/lib/python3/dist-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.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "ring_floodlight.py", line 67, in main() File "ring_floodlight.py", line 48, in main auth.fetch_token(username, password, otp_callback()) File "/srv/dev/lib/python/ring_doorbell/auth.py", line 35, in fetch_token token = self._oauth.fetch_token( File "/usr/local/lib/python3.8/dist-packages/requests_oauthlib/oauth2_session.py", line 360, in fetch_token self._client.parse_request_body_response(r.text, scope=self.scope) File "/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 421, in parse_request_body_response self.token = parse_token_response(body, scope=scope) File "/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/parameters.py", line 431, in parse_token_response validate_token_parameters(params) File "/usr/lib/python3/dist-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.

simmonyau avatar Jul 02 '21 19:07 simmonyau

Same, last success was July 1st. Moved the old token out of the way, am prompted for 2FA code, but never get one delivered to my email. Do get the code when signing in with browser, but that code does not work, as expected. Looks like Ring changed their 2FA methods. I have no idea how any of that oauth2 stuff works though.

4Dolio avatar Jul 05 '21 11:07 4Dolio

Same here.

EnGamma avatar Jul 05 '21 15:07 EnGamma

Interesting.... ringcli.py works. Trying to see what is different between its authentication and my script.

dlemmink avatar Jul 05 '21 15:07 dlemmink

Solved: The ID in Auth cannot be the default "MyProject/1.0" Ring seems to be flagging this.

    auth = Auth("**CHANGE_THIS**", json.loads(cache_file.read_text()), token_updated)

dlemmink avatar Jul 05 '21 15:07 dlemmink

I also had to comment out line 58 of init.py

# self.update_groups()

Perhaps because I don't have groups set up? It was returning: AttributeError: 'NoneType' object has no attribute 'get'

legendarylion avatar Jul 05 '21 16:07 legendarylion

That did it, But I think I did alter it to "MyProject/1.0d" which apparently isn't enough anymore. Should use "PleaseForTheLoveOfferAnOfficialAPI/1.234e" or some such.

Solved: The ID in Auth cannot be the default "MyProject/1.0" Ring seems to be flagging this.

    auth = Auth("**CHANGE_THIS**", json.loads(cache_file.read_text()), token_updated)

4Dolio avatar Jul 05 '21 20:07 4Dolio

@dlemmink That solved the issue, thanks!

simmonyau avatar Jul 06 '21 00:07 simmonyau

ID name change in Auth fixed it for me too. Thanks.

EnGamma avatar Jul 06 '21 03:07 EnGamma

I also had to comment out line 58 of init.py

# self.update_groups()

Perhaps because I don't have groups set up? It was returning: AttributeError: 'NoneType' object has no attribute 'get'

You might modify as mentioned here https://github.com/alexlatchford/python-ring-doorbell/commit/07171a5d11da0bcdafe1878b06599f0bcfa1b249 instead of comment out...

jfmennedy avatar Jul 09 '21 12:07 jfmennedy

Thanks @dlemmink

gauravrawat724 avatar Sep 10 '21 19:09 gauravrawat724

Getting this same error. I did change the ID in the Auth and it didn't work.

ccthiel avatar Mar 02 '22 22:03 ccthiel

Changing the project id worked for me 2

OldStarFox avatar Apr 18 '22 18:04 OldStarFox

I changed the Project ID to all different names/codes but always " MissingTokenError: (missing_token) Missing access token parameter."

Please help!

Thanks

PvdGulik avatar Feb 22 '23 21:02 PvdGulik

Closing this as stale and I think fixed in the latest master

sdb9696 avatar Mar 21 '24 09:03 sdb9696