Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Removing contact permissions does not trigger new consent prompt #158

Open
Tibernut opened this issue Apr 24, 2019 · 0 comments
Open

Removing contact permissions does not trigger new consent prompt #158

Tibernut opened this issue Apr 24, 2019 · 0 comments

Comments

@Tibernut
Copy link

I accidentally gave indicator-kdeconnect permissions for the wrong google account when syncing my contacts for the first time. When I removed those permissions and attempted a resync I only got a 'Token has been expired or revoked from' error oauth. I was unable to add a new account until I manually deleted token.json and contacts.json from ~/.local/share/indicator-kdeconnect.

It would be good if indicator-kdeconnect had a mechanism for adding/removing a google account for contacts synchronization. Failing that, maybe it would be better to trigger self.get_consent() if self.refresh_token() fails on line 169 in indicator-kdeconnect/src/extensions/sms/sms.py.

Thank you for the great work so far!

error trace:
Exception in thread Sync:
Traceback (most recent call last):
File "/usr/share/indicator-kdeconnect/Sms.py", line 167, in get_contacts
space_requests, connections = get_connections()
File "/usr/share/indicator-kdeconnect/Sms.py", line 150, in get_connections
response = google.get(people_api, params=params_paging).json()
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python3/dist-packages/requests_oauthlib/oauth2_session.py", line 330, in request
http_method=method, body=data, headers=headers)
File "/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 193, in add_token
raise TokenExpiredError()
oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/usr/share/indicator-kdeconnect/Sms.py", line 169, in get_contacts
self.refresh_token()
File "/usr/share/indicator-kdeconnect/Sms.py", line 134, in refresh_token
client_secret=self.client_secret)
File "/usr/lib/python3/dist-packages/requests_oauthlib/oauth2_session.py", line 309, in refresh_token
self.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 408, 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 379, in parse_token_response
validate_token_parameters(params)
File "/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/parameters.py", line 386, in validate_token_parameters
raise_from_error(params.get('error'), params)
File "/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/errors.py", line 415, in raise_from_error
raise cls(**kwargs)
oauthlib.oauth2.rfc6749.errors.InvalidGrantError: (invalid_grant) Token has been expired or revoked.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant