Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

401 error #168

Open
fir3drag0n opened this issue Apr 23, 2024 · 2 comments
Open

401 error #168

fir3drag0n opened this issue Apr 23, 2024 · 2 comments

Comments

@fir3drag0n
Copy link

fir3drag0n commented Apr 23, 2024

Hi,

unfortunately, I cannot get docker so start. I have used the correct token, but I always get the same result:

2024-04-23 09:46:10,495 - withings - INFO - Get Access Token
2024-04-23 09:46:10,671 - withings - INFO - Refresh Access Token
2024-04-23 09:46:10,828 - root - INFO - Fetching measurements from 2022-01-01 00:00 to 2024-04-23 23:59
2024-04-23 09:46:11,038 - withings - INFO - Get Measurements
2024-04-23 09:46:11,228 - root - INFO - No blood pressure data to sync for FIT file
2024-04-23 09:46:11,228 - root - INFO - No TrainerRoad username or a new measurement - skipping sync
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/garth-0.4.45-py3.10.egg/garth/http.py", line 139, in request
    self.last_resp.raise_for_status()
  File "/usr/local/lib/python3.10/site-packages/requests-2.31.0-py3.10.egg/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://sso.garmin.com/sso/signin?id=gauth-widget&embedWidget=true&gauthHost=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&service=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&source=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&redirectAfterAccountLoginUrl=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&redirectAfterAccountCreationUrl=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/withings_sync-4.2.4-py3.10.egg/withings_sync/garmin.py", line 44, in login
    self.client.login(email, password)
  File "/usr/local/lib/python3.10/site-packages/garth-0.4.45-py3.10.egg/garth/http.py", line 160, in login
    self.oauth1_token, self.oauth2_token = sso.login(
  File "/usr/local/lib/python3.10/site-packages/garth-0.4.45-py3.10.egg/garth/sso.py", line 83, in login
    client.post(
  File "/usr/local/lib/python3.10/site-packages/garth-0.4.45-py3.10.egg/garth/http.py", line 151, in post
    return self.request("POST", *args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/garth-0.4.45-py3.10.egg/garth/http.py", line 141, in request
    raise GarthHTTPError(
garth.exc.GarthHTTPError: Error in request: 401 Client Error: Unauthorized for url: https://sso.garmin.com/sso/signin?id=gauth-widget&embedWidget=true&gauthHost=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&service=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&source=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&redirectAfterAccountLoginUrl=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&redirectAfterAccountCreationUrl=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/withings-sync", line 33, in <module>
    sys.exit(load_entry_point('withings-sync==4.2.4', 'console_scripts', 'withings-sync')())
  File "/usr/local/lib/python3.10/site-packages/withings_sync-4.2.4-py3.10.egg/withings_sync/sync.py", line 505, in main
    sync()
  File "/usr/local/lib/python3.10/site-packages/withings_sync-4.2.4-py3.10.egg/withings_sync/sync.py", line 466, in sync
    gar_wg_state = sync_garmin(fit_data_weight)
  File "/usr/local/lib/python3.10/site-packages/withings_sync-4.2.4-py3.10.egg/withings_sync/sync.py", line 157, in sync_garmin
    garmin.login(ARGS.garmin_username, ARGS.garmin_password)
  File "/usr/local/lib/python3.10/site-packages/withings_sync-4.2.4-py3.10.egg/withings_sync/garmin.py", line 47, in login
    raise APIException("Authentication failure: {}. Did you enter correct credentials?".format(ex))
withings_sync.garmin.APIException: Authentication failure: Error in request: 401 Client Error: Unauthorized for url: https://sso.garmin.com/sso/signin?id=gauth-widget&embedWidget=true&gauthHost=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&service=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&source=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&redirectAfterAccountLoginUrl=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed&redirectAfterAccountCreationUrl=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fembed. Did you enter correct credentials?

@JeanMichelDeveloper
Copy link

Hello,

Same problem for me when I run it in Powershell. When I enter my cedentials using the SSO link I don't have any issue.

@michaelknox
Copy link

I think i might have the same problem:

user@server:~$ docker start -i 35ba9edeb7a62835c5771842949b34003ad1395d6135c5c12d7d8885c56feca5
2024-10-21 12:47:33,114 - withings - INFO - Refresh Access Token
2024-10-21 12:47:33,325 - root - INFO - Fetching measurements from 2024-08-08 20:01 to 2024-10-21 23:59
2024-10-21 12:47:33,618 - withings - INFO - Get Measurements
2024-10-21 12:47:33,833 - root - INFO - 2024-10-01 07:32:57 This Withings metric contains no weight data or blood pressure.  Not syncing...
2024-10-21 12:47:33,835 - root - INFO - 2024-08-22 05:34:55 This Withings metric contains no weight data or blood pressure.  Not syncing...
2024-10-21 12:47:33,851 - root - INFO - No TrainerRoad username or a new measurement - skipping sync
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/requests-2.32.3-py3.10.egg/requests/models.py", line 974, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/withings-sync", line 33, in <module>
    sys.exit(load_entry_point('withings-sync==4.2.6a0', 'console_scripts', 'withings-sync')())
  File "/usr/local/lib/python3.10/site-packages/withings_sync-4.2.6a0-py3.10.egg/withings_sync/sync.py", line 510, in main
    sync()
  File "/usr/local/lib/python3.10/site-packages/withings_sync-4.2.6a0-py3.10.egg/withings_sync/sync.py", line 469, in sync
    gar_wg_state = sync_garmin(fit_data_weight)
  File "/usr/local/lib/python3.10/site-packages/withings_sync-4.2.6a0-py3.10.egg/withings_sync/sync.py", line 157, in sync_garmin
    garmin.login(ARGS.garmin_username, ARGS.garmin_password)
  File "/usr/local/lib/python3.10/site-packages/withings_sync-4.2.6a0-py3.10.egg/withings_sync/garmin.py", line 36, in login
    if hasattr(self.client, "username"):
  File "/usr/local/lib/python3.10/site-packages/garth-0.4.46-py3.10.egg/garth/http.py", line 109, in username
    return self.profile["userName"]
  File "/usr/local/lib/python3.10/site-packages/garth-0.4.46-py3.10.egg/garth/http.py", line 101, in profile
    self._profile = self.connectapi(
  File "/usr/local/lib/python3.10/site-packages/garth-0.4.46-py3.10.egg/garth/http.py", line 171, in connectapi
    resp = self.request(method, "connectapi", path, api=True, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/garth-0.4.46-py3.10.egg/garth/http.py", line 129, in request
    self.refresh_oauth2()
  File "/usr/local/lib/python3.10/site-packages/garth-0.4.46-py3.10.egg/garth/http.py", line 168, in refresh_oauth2
    self.oauth2_token = sso.exchange(self.oauth1_token, self)
  File "/usr/local/lib/python3.10/site-packages/garth-0.4.46-py3.10.egg/garth/sso.py", line 146, in exchange
    ).json()
  File "/usr/local/lib/python3.10/site-packages/requests-2.32.3-py3.10.egg/requests/models.py", line 978, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

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

No branches or pull requests

3 participants