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

HTTP 403 Authentication Error #59

Closed
RyanAugust opened this issue May 25, 2021 · 9 comments
Closed

HTTP 403 Authentication Error #59

RyanAugust opened this issue May 25, 2021 · 9 comments

Comments

@RyanAugust
Copy link

Raising the presence of a new round of authentication errors.

Connecting to Garmin Connect... Done.
[ERROR] Failed to reach url https://sso.garmin.com/sso/signin?service=https%3A%2F%2Fconnect.garmin.com%2Flegacy%2Fsession&webhost=https%3A%2F%2Fconnect.garmin.com&source=https%3A%2F%2Fconnect.garmin.com%2Fen-US%2Fsignin&redirectAfterAccountLoginUrl=https%3A%2F%2Fconnect.garmin.com%2Flegacy%2Fsession&redirectAfterAccountCreationUrl=https%3A%2F%2Fconnect.garmin.com%2Flegacy%2Fsession&gauthHost=https%3A%2F%2Fsso.garmin.com%2Fsso&locale=en_US&id=gauth-widget&cssUrl=https%3A%2F%2Fstatic.garmincdn.com%2Fcom.garmin.connect%2Fui%2Fcss%2Fgauth-custom-v1.2-min.css&clientId=GarminConnect&rememberMeShown=true&rememberMeChecked=false&createAccountShown=true&openCreateAccount=false&displayNameShown=false&consumeServiceTicket=false&initialFocus=true&embedWidget=false&generateExtraServiceTicket=true&generateTwoExtraServiceTickets=false&generateNoServiceTicket=false&globalOptInShown=true&globalOptInChecked=false&mobile=false&connectLegalTerms=true&locationPromptShown=true&showPassword=true#, error: HTTP Error 403: Forbidden
Requesting Login ticket...Traceback (most recent call last):
  File "C:\Users\ryand\git\garmin-connect-export\gcexport.py", line 1063, in <module>
    main(sys.argv)
  File "C:\Users\ryand\git\garmin-connect-export\gcexport.py", line 865, in main
    login_to_garmin_connect(args)
  File "C:\Users\ryand\git\garmin-connect-export\gcexport.py", line 516, in login_to_garmin_connect
    login_response = http_req_as_string(URL_GC_LOGIN + '#', post_data, headers)
  File "C:\Users\ryand\git\garmin-connect-export\gcexport.py", line 273, in http_req_as_string
    return http_req(url, post, headers).decode()
  File "C:\Users\ryand\git\garmin-connect-export\gcexport.py", line 249, in http_req
    response = OPENER.open(request, data=post)
  File "C:\Users\ryand\miniconda3\envs\gc_36\lib\urllib\request.py", line 532, in open
    response = meth(req, response)
  File "C:\Users\ryand\miniconda3\envs\gc_36\lib\urllib\request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Users\ryand\miniconda3\envs\gc_36\lib\urllib\request.py", line 570, in error
    return self._call_chain(*args)
  File "C:\Users\ryand\miniconda3\envs\gc_36\lib\urllib\request.py", line 504, in _call_chain
    result = func(*args)
  File "C:\Users\ryand\miniconda3\envs\gc_36\lib\urllib\request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

Will need to confirm if this call is running into the same cloudflare error that other repos such as garmin-uploader have reported. The workaround currently in place there is to make the calls more cloudflare friendly by replaceing the requests with cloudscraper (see here).

I'll do some tests tonight to confirm the proplem and check the viability of this fix for us as well.

@sgowtham
Copy link

sgowtham commented May 25, 2021 via email

@mainzelM
Copy link

I'm experiencing this problem as well for quite some time. However, for me the cloudscraper-based fixes did not work (I've ran into a 403 with https://github.com/jacobhell/garminexport)

@moderation
Copy link
Contributor

I've downloaded rides from Sunday and today (US California time) with my fork at https://github.com/moderation/garmin-connect-export without errors

@Ebrohm
Copy link

Ebrohm commented May 25, 2021

I had the same problem last week. I switched from Python 3.4 to 3.9. Now it works fine.

@pe-st
Copy link
Owner

pe-st commented May 25, 2021

What version of Python do you use, @RyanAugust ? Is it 3.6 as "C:\Users\ryand\miniconda3\envs\gc_36\lib\urllib\request.py" in your stacktrace might suggest?

I have no such problems using Python 3.9

@rsjrny
Copy link

rsjrny commented May 25, 2021

I have also tested with Python 3.6, 3.7, and 3.9. Version 3.9 has no issues downloading

@mainzelM
Copy link

I'm experiencing this problem as well for quite some time. However, for me the cloudscraper-based fixes did not work (I've ran into a 403 with https://github.com/jacobhell/garminexport)

Yes, it's related to the Python version. Moving from Python 2.7.5 to Python 3.6.8 fixes the problem.

@RyanAugust
Copy link
Author

@pe-st Yes, was running in a 3.6.13 environment. Following @rsjrny suggestion, I'm not encountering errors when executing within 3.7 or 3.9 environments.

@pe-st
Copy link
Owner

pe-st commented May 27, 2021

As @RyanAugust confirmed, this is not an issue of the script, but of the Python version. It makes no sense to work around HTTP issues of old versions if upgrading to newer 3.x version solves the issue.

@pe-st pe-st closed this as completed May 27, 2021
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

7 participants