Giter Site home page Giter Site logo

Comments (15)

hhuitema avatar hhuitema commented on July 4, 2024 1

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"

from carelink-python-client.

sbecze avatar sbecze commented on July 4, 2024

Connection log:

[2023-06-28 10:31:02:DEBUG] HTTP server started at http://0.0.0.0:8081
[2023-06-28 10:31:02:DEBUG] Starting new HTTPS connection (1): carelink.minimed.eu:443
[2023-06-28 10:31:04:DEBUG] https://carelink.minimed.eu:443 "GET /patient/sso/login?country=hu&lang=en HTTP/1.1" 303 0
[2023-06-28 10:31:04:DEBUG] Starting new HTTPS connection (1): mdtlogin-ocl.medtronic.com:443
[2023-06-28 10:31:04:DEBUG] https://mdtlogin-ocl.medtronic.com:443 "GET /mmcl/auth/oauth/v2/authorize?client_id=fc310f93-e8c1-4719-ae9c-69d65884e235&response_type=code&redirect_uri=https://carelink.minimed.eu/patient/sso/auth&scope=openid%20profile%20roles&state=auth&response_mode=query&lang=en&country=hu&code_challenge=Kj-Fz86_aCxn7D1Qqc8VN5hip9bdFr5nz-QROvb8MIw&code_challenge_method=S256 HTTP/1.1" 302 20
[2023-06-28 10:31:04:DEBUG] https://mdtlogin-ocl.medtronic.com:443 "GET /mmcl/auth/oauth/v2/authorize/login?action=display&sessionID=3bc41ed2-fd60-4572-9871-31a9854dedbe&sessionData=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.ew0KICAgICJzZXNzaW9uIjogew0KICAgICAgICAic2Vzc2lvbklEIjoiM2JjNDFlZDItZmQ2MC00NTcyLTk4NzEtMzFhOTg1NGRlZGJlIiwNCiAgICAgICAgImV4cCI6MTY4Nzk0NDY2NCwNCiAgICAgICAgImN1cnJlbnRfdXNlcm5hbWUiOiIiLA0KICAgICAgICAiY3VycmVudF91c2VyX2NvbnNlbnQiOiJub25lIiwNCiAgICAgICAgImN1cnJlbnRfdXNlcl9yb2xlIjoiIiwNCiAgICAgICAgImN1cnJlbnRfdXNlcl9hY3IiOiIwIiwNCiAgICAgICAgImN1cnJlbnRfdXNlcl9hdXRoVGltZSI6IjAiLA0KICAgICAgICAiY3VycmVudF91c2VyX2F0dHJpYnV0ZXMiOiIiLA0KICAgICAgICAic2FsdCI6IiIsDQogICAgICAgICJ0aGlyZF9wYXJ0eV9zc29fdG9rZW4iOiIiLA0KICAgICAgICAidGhpcmRfcGFydHlfc3NvX3Rva2VuX3R5cGUiOiIiDQogICAgfSwNCiAgICAicmVxdWVzdF9jb25zZW50Ijogew0KICAgICAgICAiY2xpZW50X25hbWUiOiJPQ0wrLStXZWIrYXBwKy0rT1VTIiwNCiAgICAgICAgInNjb3BlX3ZlcmlmaWVkIjoib3BlbmlkK3Byb2ZpbGUrcm9sZXMiDQogICAgfSwNCiAgICAicmVxdWVzdF9wYXJhbWV0ZXJzIjogew0KICAgICAgICAiZGlzcGxheSI6InBhZ2UiLA0KICAgICAgICAicHJvbXB0IjoibG9naW4rY29uc2VudCIsDQogICAgICAgICJpZF90b2tlbl9oaW50IjoiIiwNCiAgICAgICAgImxvZ2luX2hpbnQiOiIiLA0KICAgICAgICAiYWNyX3ZhbHVlcyI6IiIsDQogICAgICAgICJjbGllbnRfaWQiOiJmYzMxMGY5My1lOGMxLTQ3MTktYWU5Yy02OWQ2NTg4NGUyMzUiLA0KICAgICAgICAibm9uY2UiOiIiLA0KICAgICAgICAic2NvcGUiOiJvcGVuaWQrcHJvZmlsZStyb2xlcyIsDQogICAgICAgICJtYXhfYWdlIjogIiINCiAgICB9DQp9.zcSx0YIiFR8HcpywwRmeFwBecFEByO5qpzsYSONbNrE&locale=en&countrycode=hu HTTP/1.1" 200 1741
[2023-06-28 10:31:04:DEBUG] Starting new HTTPS connection (1): mdtlogin.medtronic.com:443
[2023-06-28 10:31:05:DEBUG] https://mdtlogin.medtronic.com:443 "POST /mmcl/auth/oauth/v2/authorize/login?country=hu&locale=en HTTP/1.1" 400 1806
Client login error! Response code: 400 Error message: local variable 'response' referenced before assignment

from carelink-python-client.

ondrej1024 avatar ondrej1024 commented on July 4, 2024

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 ?

from carelink-python-client.

hhuitema avatar hhuitema commented on July 4, 2024

I cannot confirm, because it is not working in my case. (unclear what the issue is)
but others have mentioned a succesfull fix.

yo-han/Home-Assistant-Carelink#36

from carelink-python-client.

Akilan1999 avatar Akilan1999 commented on July 4, 2024

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 !

from carelink-python-client.

tloczekt avatar tloczekt commented on July 4, 2024

@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

from carelink-python-client.

tloczekt avatar tloczekt commented on July 4, 2024

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:])

from carelink-python-client.

ondrej1024 avatar ondrej1024 commented on July 4, 2024

@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?

from carelink-python-client.

tloczekt avatar tloczekt commented on July 4, 2024

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://......."

from carelink-python-client.

SmokelessLlama avatar SmokelessLlama commented on July 4, 2024

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?

from carelink-python-client.

tloczekt avatar tloczekt commented on July 4, 2024

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

from carelink-python-client.

SmokelessLlama avatar SmokelessLlama commented on July 4, 2024

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'

from carelink-python-client.

ondrej1024 avatar ondrej1024 commented on July 4, 2024

Here is a fix that removes the hard coded login server name:
4e01d51

Please anyone try and confirm that it works for you (both EU and US).

from carelink-python-client.

tloczekt avatar tloczekt commented on July 4, 2024

It works for my daughter (EU) and friend in US.

from carelink-python-client.

ondrej1024 avatar ondrej1024 commented on July 4, 2024

It works for my daughter (EU) and friend in US.

Great, thanks for the feedback

from carelink-python-client.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.