Closed sbc2280 closed 1 year ago
Giving some feedback as an interested party.. (the home-assistant integration has resolved this problem)
Medtronic change the auth server url url = "https://mdtlogin.medtronic.com" + "/mmcl/auth/oauth/v2/authorize/login"
Should become url = "https://mdtlogin-ocl.medtronic.com" + "/mmcl/auth/oauth/v2/authorize/login"
There has been some maintenance downtime of the Carelink service yesterday. So I was actually afraid that something would change and break things. Did anyone try the new login URL in the carelink-python-client ?
I cannot confirm, because it is not working in my case. (unclear what the issue is) but others have mentioned a succesfull fix.
Giving some feedback as an interested party.. (the home-assistant integration has resolved this problem)
Medtronic change the auth server url url = "https://mdtlogin.medtronic.com" + "/mmcl/auth/oauth/v2/authorize/login"
Should become url = "https://mdtlogin-ocl.medtronic.com" + "/mmcl/auth/oauth/v2/authorize/login"
This worked for me thanks !
@hhuitema, @ondrej1024 be careful, new url works only for EU Carelink server, US host is still "https://mdtlogin.medtronic.com/"
More flexible and universal can be similar like : url = loginSessionResponse.url.scheme + "://" + loginSessionResponse.url.host + "".join(loginSessionResponse.url().encodedPath().substring(1))
it's not tested, it's only suggestion
I'm sorry I mixed languages: in python should be rather: from urllib.parse import urlparse
url = loginSessionResponse.url.scheme + "://" + loginSessionResponse.url.host + "".join(urlparse(loginSessionResponse.url).path[1:])
@tloczekt , thanks for your suggestion. In fact, I don't think we should have a hard coded login server if the information is provided by the API. But it is not clear to me where you take this information from. Is it in the response to the initial connection request?
I mean 128 line in Carelink_client.py
You have url="......". You have one host for all server, but EU has now = "https://mdtlogin-ocl.medtronic.com" but US has old one = "https://mdtlogin.medtronic.com" .
I recommend to use loginSessionResponse.url.host instead of text "https://......."
I just updated in HACS and am now getting "Unexpected error fetching carelink data: 'auth_tmp_token'"
In the US, do I need to change that url?
I just updated in HACS and am now getting "Unexpected error fetching carelink data: 'auth_tmp_token'"
In the US, do I need to change that url?
US has still old one = "https://mdtlogin.medtronic.com" as I know.
But it seems your issue is different. It seems sth wrong with token
Is there anything I can do to resolve this error or do I just need to wait it out for an update? more detail:
2023-06-29 12:00:27.474 ERROR (MainThread) [custom_components.carelink] Unexpected error fetching carelink data: 'auth_tmp_token' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/carelink/init.py", line 149, in _async_update_data recent_data = await self.client.get_recent_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/carelink/api.py", line 467, in get_recent_data if await self.__get_authorization_token() is not None: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/carelink/api.py", line 429, in __get_authorization_token auth_token = self.async_client.cookies[CARELINK_AUTH_TOKEN_COOKIE_NAME]
File "/usr/local/lib/python3.11/site-packages/httpx/_models.py", line 1148, in __getitem__
raise KeyError(name)
KeyError: 'auth_tmp_token'
Here is a fix that removes the hard coded login server name: https://github.com/ondrej1024/carelink-python-client/commit/4e01d510968edbdc6fd21ba0dc542fbee6c30bc2
Please anyone try and confirm that it works for you (both EU and US).
It works for my daughter (EU) and friend in US.
It works for my daughter (EU) and friend in US.
Great, thanks for the feedback
Connection log: