updated authentication procedure

This commit is contained in:
petergardfjall 2016-12-14 20:24:12 +01:00
parent 16c8a74790
commit 93d27057dc

View File

@ -104,7 +104,8 @@ class GarminClient(object):
params = { params = {
"service": "http://connect.garmin.com/post-auth/login", "service": "http://connect.garmin.com/post-auth/login",
"clientId": "GarminConnect", "clientId": "GarminConnect",
"consumeServiceTicket": "false" "consumeServiceTicket": "false",
"gauthHost": "https://sso.garmin.com/sso"
} }
flow_execution_key = self._get_flow_execution_key(params) flow_execution_key = self._get_flow_execution_key(params)
log.debug("flow execution key: '{}'".format(flow_execution_key)) log.debug("flow execution key: '{}'".format(flow_execution_key))
@ -131,12 +132,12 @@ class GarminClient(object):
"auth failure: %s: code %d: %s" % "auth failure: %s: code %d: %s" %
(SSO_LOGIN_URL, response.status_code, response.text)) (SSO_LOGIN_URL, response.status_code, response.text))
# extract flowExecutionKey # extract flowExecutionKey
match = re.search(r'name="lt"\s+value="([^"]+)"', response.text) match = re.search(r'<!-- flowExecutionKey: \[(\w+)\]', response.text)
if not match: if not match:
raise RuntimeError( raise RuntimeError(
"auth failure: unable to extract flowExecutionKey: %s:\n%s" % "auth failure: unable to extract flowExecutionKey: %s:\n%s" %
(SSO_LOGIN_URL, response.text)) (SSO_LOGIN_URL, response.text))
flow_execution_key = match.groups(1)[0] flow_execution_key = match.group(1)
return flow_execution_key return flow_execution_key