garmin login endpoint has changed

This commit is contained in:
petergardfjall 2019-04-16 20:04:18 +02:00
parent c8d1958d07
commit beeb052b36

View File

@ -37,7 +37,7 @@ log = logging.getLogger(__name__)
# reduce logging noise from requests library # reduce logging noise from requests library
logging.getLogger("requests").setLevel(logging.ERROR) logging.getLogger("requests").setLevel(logging.ERROR)
SSO_LOGIN_URL = "https://sso.garmin.com/sso/login" SSO_LOGIN_URL = "https://sso.garmin.com/sso/signin"
"""The Garmin Connect Single-Sign On login URL.""" """The Garmin Connect Single-Sign On login URL."""
@ -110,8 +110,9 @@ class GarminClient(object):
request_params = { request_params = {
"service": "https://connect.garmin.com/modern" "service": "https://connect.garmin.com/modern"
} }
headers={'origin': 'https://sso.garmin.com'}
auth_response = self.session.post( auth_response = self.session.post(
SSO_LOGIN_URL, params=request_params, data=form_data) SSO_LOGIN_URL, headers=headers, params=request_params, data=form_data)
log.debug("got auth response: %s", auth_response.text) log.debug("got auth response: %s", auth_response.text)
if auth_response.status_code != 200: if auth_response.status_code != 200:
raise ValueError( raise ValueError(