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

authentication failure #83

Closed
leekirk1975 opened this issue Jun 12, 2021 · 10 comments
Closed

authentication failure #83

leekirk1975 opened this issue Jun 12, 2021 · 10 comments

Comments

@leekirk1975
Copy link

This is a great library I use all the time.

After I added the user agent, everything seemed to be running fine. I had not run this for a few weeks but now I seem to be getting an authentication error again.

raise ValueError("authentication failure: did you enter valid credentials?")

ValueError: authentication failure: did you enter valid credentials?

After a couple of hours of debugging, I have not been able to diagnose the issue. any ideas what the problem might be.
(Note I am n enthiustatic ametur)

@oozz-software
Copy link

LOG LEVEL DEBUG

Something went wrong, and our site is temporarily unavailable.
We’re already working to get things back on course.

    <div class="app__error__details">
      <div class="cf-error-details cf-error-1020">

Access denied

This website is using a security service to protect itself from online attacks.

  • Ray ID: 65e3d03249600482
  • Timestamp: 2021-06-12 14:36:45 UTC
  • Your IP address: 37.163.160.130
  • Requested URL: sso.garmin.com/sso/signin?service=https%3A%2F%2Fconnect.garmin.com%2Fmodern%2F&gauthHost=https%3A%2F%2Fsso.garmin.com%2Fsso
  • Error reference number: 1020
  • Server ID: FL_19F296
  • User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36
    </div>
  </div>
</div>
2021-06-12 16:36:46,421 [ERROR] failed with exception: authentication failure: did you enter valid credentials?

@paolos7709
Copy link

paolos7709 commented Jun 15, 2021

I confirm exactly the same issue as you're describing...

garmin-backup --user-agent="$(uagen safari osx)" --password "$(PWD)" "$(LOGIN)"

2021-06-15 15:46:17,266 [INFO] backing up formats: json_summary, json_details, gpx, tcx, fit
2021-06-15 15:46:17,268 [INFO] authenticating user ...
2021-06-15 15:46:17,268 [INFO] fetching CSRF token ...
2021-06-15 15:46:18,128 [ERROR] failed with exception: authentication failure: did you enter valid credentials?

@zxxxh
Copy link

zxxxh commented Jun 15, 2021

XXXXXXXXXX@XXXXXXXXXX garmin-backup % garmin-backup XXXXXXXXXX@XXXXXXXXXX --password='XXXXXXXXXX' --backup-dir ~/XXXXXXXXXX --max-retries=1 --user-agent="ua"
2021-06-15 09:54:08,968 [INFO] backing up formats: json_summary, json_details, gpx, tcx, fit
2021-06-15 09:54:08,983 [INFO] authenticating user ...
2021-06-15 09:54:08,983 [INFO] fetching CSRF token ...
2021-06-15 09:54:10,068 [INFO] claiming auth ticket ...
2021-06-15 09:54:12,154 [INFO] scanning activities for XXXXXXXXXX@XXXXXXXXXX ...
2021-06-15 09:54:12,154 [INFO] {list_activities}: attempt 1 ...
2021-06-15 09:54:16,660 [INFO] account has a total of XXXXXXXXXX activities
2021-06-15 09:54:17,088 [INFO] /Users/XXXXXXXXXX/XXXXXXXXXX contains XXXXXXXXXX backed up activities
2021-06-15 09:54:17,088 [INFO] activities that aren't backed up: 4
2021-06-15 09:54:17,088 [INFO] backing up activity XXXXXXXXXX from 2021-06-15 09:28:37+00:00 (1 out of 4) ...
2021-06-15 09:54:17,088 [INFO] {get_activity_summary}: attempt 1 ...
2021-06-15 09:54:17,341 [INFO] {get_activity_details}: attempt 1 ...
2021-06-15 09:54:18,055 [INFO] {get_activity_gpx}: attempt 1 ...
2021-06-15 09:54:19,521 [INFO] {get_activity_tcx}: attempt 1 ...
2021-06-15 09:54:22,262 [INFO] {get_activity_fit}: attempt 1 ...
2021-06-15 09:54:22,545 [INFO] backing up activity XXXXXXXXXX from 2021-06-13 11:59:35+00:00 (2 out of 4) ...
2021-06-15 09:54:22,545 [INFO] {get_activity_summary}: attempt 1 ...

Working fine here. Note: Release 0.40.0 doesn't work. You need to incorporate this change, as it hasn't been incorporated into the main release (yet?).

@petergardfjall
Copy link
Owner

Sorry for the late response. I just tried a backup of my account with 0.4.0 and it worked without issues. Maybe Garmin has chosen to deactivate the CloudFlare bot protection?

@chk86
Copy link

chk86 commented Aug 5, 2021

I am also on 0.4.0 and I am still receiving the authentication failure message.

sh-4.4# garmin-backup --backup-dir=activities xxxxxxx@gmail.com
2021-08-04 23:35:14,625 [INFO] backing up formats: json_summary, json_details, gpx, tcx, fit
Enter password:
2021-08-04 23:35:18,390 [INFO] authenticating user ...
2021-08-04 23:35:18,390 [INFO] fetching CSRF token ...
2021-08-04 23:35:18,799 [ERROR] failed with exception: authentication failure: did you enter valid credentials?

@elteto
Copy link

elteto commented Aug 10, 2021

same problem here, i tried to autenticate with my gmail account and with my user and get the same error.

@petergardfjall
Copy link
Owner

For me, authentication still works with 0.4.0.

I'd like to better understand the reasons for failure. Do people that experience these failures run the backup script too often (getting a temporary CloudFlare ban)?

Several people seem to have used #80 with some success, although it's unclear to me if that's a foolproof solution or if it is a hit-and-miss fix as well. Some comments seem to indicate that it doesn't always work (for example, #79 (comment)).

I'm a bit reluctant to just pull in the cloudscraper library unless that takes care of the issues with certainty, which I'm not convinced of yet.

@mrw34
Copy link

mrw34 commented Aug 14, 2021

For me:

  • I only run the script occasionally and authentication often fails
  • Adding cloudscraper dependency to resolve cloudflare auth issues #80 doesn't immediately solve the problem when authentication is failing - but I didn't configure any captcha solvers
  • I am on a 4G connection and occasionally see Cloudflare's bot protection page during normal web browsing
  • If I instead run the script on a cloud VM with a fixed/dedicated IP address then authentication never fails

I'd assume from this that Cloudflare's bot protection only kicks in for some people, and even for those people it may only apply some of the time. This wouldn't be so surprising, given that it seems to be based on various heuristics, possibly including where you're connecting from, recent traffic from your IP address/block etc.

@J4cker14
Copy link

Auth problem as well

2021-09-26 20:39:30,776 [INFO] authenticating user ... 2021-09-26 20:39:30,776 [INFO] fetching CSRF token ... 2021-09-26 20:39:31,130 [ERROR] failed with exception: authentication failure: did you enter valid credentials?

@petergardfjall
Copy link
Owner

The most recent version of garminexport (0.4.1) can optionally be installed with support for circumventing Cloudflare's bot challenges like so:

pip install garminexport[cloudflare]

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

9 participants