magnific0 / nokia-weight-sync

Get weight from Nokia Health and update in Garmin Connect or Smashrun
GNU General Public License v3.0
71 stars 30 forks source link

token expired #14

Open nurps opened 5 years ago

nurps commented 5 years ago

Got this today, whats the right thing to do?:

Traceback (most recent call last): File "C:\Program Files (x86)\Python37-32\lib\site-packages\requests_oauthlib\oauth2_session.py", line 330, in request http_method=method, body=data, headers=headers) File "C:\Program Files (x86)\Python37-32\lib\site-packages\oauthlib\oauth2\rfc6749\clients\base.py", line 196, 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 "C:\Program Files (x86)\Python37-32\nokia-weight-sync-master\nokia-weight-sync.py", line 336, in groups = client_nokia.get_measures(lastupdate=last_sync) File "C:\Program Files (x86)\Python37-32\nokia-weight-sync-master\nokia.py", line 177, in get_measures r = self.request('measure', 'getmeas', kwargs) File "C:\Program Files (x86)\Python37-32\nokia-weight-sync-master\nokia.py", line 162, in request r = self.client.request(method, '/'.join(url_parts), params=params,timeout=10) File "C:\Program Files (x86)\Python37-32\lib\site-packages\requests_oauthlib\oauth2_session.py", line 343, in request self.auto_refresh_url, auth=auth, **kwargs File "C:\Program Files (x86)\Python37-32\lib\site-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 "C:\Program Files (x86)\Python37-32\lib\site-packages\oauthlib\oauth2\rfc6749\clients\base.py", line 411, in parse_request_body_response self.token = parse_token_response(body, scope=scope) File "C:\Program Files (x86)\Python37-32\lib\site-packages\oauthlib\oauth2\rfc6749\parameters.py", line 379, in parse_token_response validate_token_parameters(params) File "C:\Program Files (x86)\Python37-32\lib\site-packages\oauthlib\oauth2\rfc6749\parameters.py", line 389, in validate_token_parameters raise MissingTokenError(description="Missing access token parameter.") oauthlib.oauth2.rfc6749.errors.MissingTokenError: (missing_token) Missing access token parameter.

jschram commented 5 years ago

The token probably wasn't refreshed before expiry. I had the same issue this week.

I've fixed it by manually requesting a fresh token through nokia-weight-sync setup nokia as mentioned in this comment

nurps commented 5 years ago

Thanks, was a bit afraid that wouldn't work anymore with localhost, but it was fine. After applying the Garmin fix its running again.