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

Unknown error occurred during Garmin Connect Client login #50

Closed
jhavens12 opened this issue Jun 4, 2021 · 5 comments
Closed

Unknown error occurred during Garmin Connect Client login #50

jhavens12 opened this issue Jun 4, 2021 · 5 comments

Comments

@jhavens12
Copy link

Running code:

`#!/usr/bin/env python3

from garminconnect import (
Garmin,
GarminConnectConnectionError,
GarminConnectTooManyRequestsError,
GarminConnectAuthenticationError,
)

from datetime import date

"""
Enable debug logging
"""
import logging
logging.basicConfig(level=logging.DEBUG)

today = date.today()

"""
Initialize Garmin client with credentials
Only needed when your program is initialized
"""
print("Garmin(email, password)")
print("----------------------------------------------------------------------------------------")
try:
client = Garmin('MY_USER', 'MY_PASSWORD')
except (
GarminConnectConnectionError,
GarminConnectAuthenticationError,
GarminConnectTooManyRequestsError,
) as err:
print("Error occurred during Garmin Connect Client init: %s" % err)
quit()
except Exception: # pylint: disable=broad-except
print("Unknown error occurred during Garmin Connect Client init")
quit()

"""
Login to Garmin Connect portal
Only needed at start of your program
The library will try to relogin when session expires
"""
print("client.login()")
print("----------------------------------------------------------------------------------------")
try:
client.login()
except (
GarminConnectConnectionError,
GarminConnectAuthenticationError,
GarminConnectTooManyRequestsError,
) as err:
print("Error occurred during Garmin Connect Client login: %s" % err)
quit()
except Exception: # pylint: disable=broad-except
print()
print("Unknown error occurred during Garmin Connect Client login")
quit()`

and getting:

'DEBUG:garminconnect:Login to Garmin Connect using POST url https://sso.garmin.com/sso/signin
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): sso.garmin.com:443
DEBUG:urllib3.connectionpool:https://sso.garmin.com:443 "GET /sso/signin?webhost=https%3A%2F%2Fconnect.garmin.com&service=https%3A%2F%2Fconnect.garmin.com&source=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fsignin&redirectAfterAccountLoginUrl=https%3A%2F%2Fconnect.garmin.com&redirectAfterAccountCreationUrl=https%3A%2F%2Fconnect.garmin.com&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&usernameShown=false&displayNameShown=false&consumeServiceTicket=false&initialFocus=true&embedWidget=false&generateExtraServiceTicket=false HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:https://sso.garmin.com:443 "POST /sso/signin?webhost=https%3A%2F%2Fconnect.garmin.com&service=https%3A%2F%2Fconnect.garmin.com&source=https%3A%2F%2Fsso.garmin.com%2Fsso%2Fsignin&redirectAfterAccountLoginUrl=https%3A%2F%2Fconnect.garmin.com&redirectAfterAccountCreationUrl=https%3A%2F%2Fconnect.garmin.com&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&usernameShown=false&displayNameShown=false&consumeServiceTicket=false&initialFocus=true&embedWidget=false&generateExtraServiceTicket=false HTTP/1.1" 403 None'

Not sure what's going on - it seems like the code is working for other people? I've tried on OSX as well as Ubuntu Server with the same results. Thanks!

@bpaliswiat
Copy link

Same problem here, not sure if something has changed on Garmin side

@bpaliswiat
Copy link

Ahh, I had to login from the browser with "remember this device" checked. Now everything works perfectly

@j4nSolo
Copy link

j4nSolo commented Jun 8, 2021

In my experience, Garmin's API is highly unstable. I have this problem arbitrarily happening every now and then, but quite often. I haven't had the time yet to investigate any further the reason behind it. Maybe @cyberjunky knows more...

@TheyCallMeJames
Copy link

I'm also experiencing the same issue. My results have been inconsistent and seems to be an almost 75% failure rate. @cyberjunky I'd be more than willing assist with troubleshooting! I love what you've created thus far so I'd enjoy being a part of making it better.

@cyberjunky
Copy link
Owner

I have look at another garmin connect project (which only downloads training data) and it has another approach in logging on, I'm testing if this works better.

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

5 participants