yo-han / Home-Assistant-Carelink

Unofficial Home Assistant Carelink Component
MIT License
19 stars 8 forks source link

Cant sign-in #38

Closed bvdkerkhof closed 9 months ago

bvdkerkhof commented 10 months ago

I was having issues with my account and had to reset my password in CareLink itself. This was done succesfully and now can sign-in through the Browser, but after deleting, upgrading CareLink with HACS i'm not able to setup the CareLink integration anymore. I have enabled Debug logging and see the following:

2023-06-28 14:32:35.898 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __get_login_session() failed: exception __get_login_session() session response is not OK 504
2023-06-28 14:32:35.899 DEBUG (MainThread) [custom_components.carelink.api] Carelink API: __execute_login_procedure() failed: exception 'sessionID'

This might have to do with the switch of the Auth server as suggested in the latest release (3 hours ago)?

Home Assistant 2023.6.3 CareLink: 2023.6.5

Mister86NL commented 10 months ago

Fix van @sedy89 hierboven lost het login probleem alhier op.

yo-han commented 10 months ago

New version with a fix is released.

tloczekt commented 10 months ago

I would like to notice you that you hard coded last time new host "mdtlogin-ocl.medtronic.com" , after last Carelink maintenance, but it's true only for EU server. US server host is still "mdtlogin.medtronic.com" so it's better to change the code for more flexible. I mean 185 line in api.py.

Probably you can use : login_session_response.url.host to get suitable host server instead of hard coded text

sedy89 commented 10 months ago

I would like to notice you that you hard coded last time new host "mdtlogin-ocl.medtronic.com" , after last Carelink maintenance, but it's true only for EU server. US server host is still "mdtlogin.medtronic.com" so it's better to change the code for more flexible. I mean 185 line in api.py.

Probably you can use : login_session_response.url.host to get suitable host server instead of hard coded text

Yes, you are right. I just saw it on the xdrip PRs. Thanks for the hint!

hhuitema commented 10 months ago

2023_6 version for me is working again.. :-)

SmokelessLlama commented 10 months ago

After updating through HACS today I'm now getting:

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'

I noticed line 185 in api.py is using url = "https://mdtlogin-ocl.medtronic.com" + "/mmcl/auth/oauth/v2/authorize/login" but I'm in the US, do I need to change that to use "login_session_response.url.host"?

version 2023.6.6

SmokelessLlama commented 10 months ago

I wasn't sure how exactly it should read so I just removed the "-ocl" and it works again.

tloczekt commented 10 months ago

Screenshot_20230629-223843_Chrome It can be like this

yo-han commented 10 months ago

Login url fix release ready with version 2023.6.7

github-actions[bot] commented 9 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 9 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.