Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New global Medtronic authentication server #2909

Merged

Conversation

benceszasz
Copy link
Contributor

Medtronic global authentication server was changed.

@Navid200
Copy link
Collaborator

Thanks a lot
Has this been tested?

@Navid200
Copy link
Collaborator

This is just an idea/question. Please wait for JamOrHam. Please don't do anything based on the following.
I wonder if the items that are changed can be added to the existing form as values that can be updated by the user. Then, if there is another change like this later, we can just tell everyone what they need to change in their settings instead of having to open another PR.

@benceszasz
Copy link
Contributor Author

@Navid200 yes, I have tested it with a few different account types.

The central auth server hasn't changed for a long time, I don't think this is something that will change again in the next few years. But if it does, the path or even the entire login protocol may change also, not just the server, just like it happend about 3-4 years ago. Anyway, I will wait for your analysis and decision.

@KeithAmbrose
Copy link

Following

@Navid200 Navid200 requested a review from jamorham June 28, 2023 03:22
@gteremi
Copy link

gteremi commented Jun 28, 2023

Dear All,

I'm trying to understand the situation. If medtronic changed the server configuration, and you guys were able to identify this, (thanks God you are talented and you are able to help to others), when can we expect a new version of xdrip? How does it work? Is it a very big job to change the program codes and compile again the source code?

Thanks.

@tloczekt
Copy link

Dear All,

I'm trying to understand the situation. If medtronic changed the server configuration, and you guys were able to identify this, (thanks God you are talented and you are able to help to others), when can we expect a new version of xdrip? How does it work? Is it a very big job to change the program codes and compile again the source code?

Thanks.

Some differences are not so big, and theoretically code change is easy, but the most hard is to predicts consequences such changes for other part of software, for all users, so each code change should having been thought about carefully

@paul1956
Copy link

The initial connection request where you send the country you are from, its response always contained the address of the authentication server but many applications just hardcoded it (as I incorrectly did), if you use the information returned in ResponseMsg the code will work again. It does require assembling several parts.

Copy link

@paul1956 paul1956 Jun 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Host should not be hard coded it comes from loginSessionResponse.RequestMessage.RequestUri.Authority plus other components to build out the fill URI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paul1956 yes, thanks. I was thinking about modifying that part of the code, but my time is very limited currently so I just did a quick correction.
Actually the entire CareLink client should be refactored, there are some weak points and dirty solutions, but I don't have time for that now.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the most part they are all derived from some less the elegant code, I have been cleaning mine up over the past few months trying unsuccessfully to get 2 Factor Authentication working. But I did fix this get remove the quotes string and use the data in message response it's still just 1 line.

@jamorham jamorham merged commit 785585d into NightscoutFoundation:master Jun 28, 2023
1 check passed
@heliax01
Copy link

You are awesome guys. Thanks a lot. It is working again.

@gteremi
Copy link

gteremi commented Jun 28, 2023

and what should we do now? A new version of xdrio apk was created? Where can I found it? I'm sorry, but I'm new with github...

@mb-po
Copy link

mb-po commented Jun 28, 2023

Will the new version be uploaded tonight?

@jamorham
Copy link
Collaborator

For some reason its not showing in the releases section or on automatic update yet but you can download the latest version here:
https://github.com/NightscoutFoundation/xDrip/releases/download/2023.06.28/xDrip-plus-20230628-79d16e8.apk

@mb-po
Copy link

mb-po commented Jun 28, 2023

You are awesome guys. Thanks a lot. It is working again.

How dit you do it?

@heliax01
Copy link

Just download and install the newly created apk jamorham just posted.

@KeithAmbrose
Copy link

Still getting the same error.

@KeithAmbrose
Copy link

You are awesome guys. Thanks a lot. It is working again.

Were there any specific steps that you had to go through to get it to work?

@mb-po
Copy link

mb-po commented Jun 28, 2023

It works!! @jamorham: Thanx for the link to the new apk-file!

@illuzionist
Copy link

I downloaded a new build from the link, installed it on Samsung a71. just UPDATED the latest STABLE version. the data is coming in. perhaps those who do not work need to uninstall the application and install it again? these are just guesses.
thank you for your work!!!

@tloczekt
Copy link

Big thanks to you @jamorham, @benceszasz , @Navid200 , @paul1956 . Great job.
It works for me too, so I don't know why @KeithAmbrose has a error.

@paul1956
Copy link

I think it depends on what county/server the person is in/on. The US server I use to connect to CareLink didn't change and if I try the new URL I can't log in.

@gteremi
Copy link

gteremi commented Jun 28, 2023

Dear All,

thanks for the APK. The new version of xDrip is installed, it can no w login, but if I configure the xdrip to save data to cloud, and I enable the nightscout sync, in the log of the uploaders, I got this error message:

Unable to do REST API Upload: Not Found marking record: failed

Any idea?

@Navid200
Copy link
Collaborator

Navid200 commented Jun 28, 2023

@gteremi That is not related to this PR.
Please open a discussion and present the problem and we will help you.

Edit:
https://github.com/NightscoutFoundation/xDrip/discussions

@gteremi
Copy link

gteremi commented Jun 28, 2023

Thanks.

@benceszasz
Copy link
Contributor Author

Unfortunately it seems that the different auth server is only used for the EU and not for the US (at least for now). The new EU auth server was previously used only for China, but currently US still uses the old auth server. It seems that at the end the base logic of the auth server login request needs to be changed and the url needs to be taken over from the regional CareLink Personal login page's redirection.
On the other hand CareLink is still not always stable. In the morning the EU regional login page redirected to the old auth server and caused login errors, because the correct auth server would have been the new one. Thus I wasn't able to login using the CareLink webpage in a browser, but xdrip was still working fine, because the new auth server was hard coded and actually that was the correct one. Anyway CareLink should become stable after some time (it seems to be now) and the dynamic auth server logic should be working.

@wtt604
Copy link

wtt604 commented Jun 28, 2023

For some reason its not showing in the releases section or on automatic update yet but you can download the latest version here: https://github.com/NightscoutFoundation/xDrip/releases/download/2023.06.28/xDrip-plus-20230628-79d16e8.apk

At the moment it's still not in the update section, but installing directly from this link worked for me. Thank you!

@Navid200
Copy link
Collaborator

@wtt604 Are on the Nightly branch? If you are, you should see it.

I have explained how xDrip update works here:
https://navid200.github.io/xDrip/docs/Updates.html

@Navid200
Copy link
Collaborator

@wtt604
This is a PR. Please allow the conversation in it to be related to the PR subject.

I have explained everything in detail about xDrip update on the page I linked.
If you don't have time or interest to read it, please open a discussion thread, and we will help you:
https://github.com/NightscoutFoundation/xDrip/discussions

@paul1956
Copy link

Unfortunately it seems that the different auth server is only used for the EU and not for the US (at least for now). The new EU auth server was previously used only for China, but currently US still uses the old auth server. It seems that at the end the base logic of the auth server login request needs to be changed and the url needs to be taken over from the regional CareLink Personal login page's redirection. On the other hand CareLink is still not always stable. In the morning the EU regional login page redirected to the old auth server and caused login errors, because the correct auth server would have been the new one. Thus I wasn't able to login using the CareLink webpage in a browser, but xdrip was still working fine, because the new auth server was hard coded and actually that was the correct one. Anyway CareLink should become stable after some time (it seems to be now) and the dynamic auth server logic should be working.

The working logic for all countries and is future proof is below in Visual Basic but all you really need is the 3rd line

        Dim url As StringBuilder
        With loginSessionResponse.RequestMessage.RequestUri
            url = New StringBuilder($"{ .Scheme}://{ .Authority}{Strings.Join(loginSessionResponse.RequestMessage.RequestUri.Segments, "")}")
        End With

Or in 1 line

url = New StringBuilder($"{ loginSessionResponse.RequestMessage.RequestUri.Scheme}://{ loginSessionResponse.RequestMessage.RequestUri.Authority}{Strings.Join(loginSessionResponse.RequestMessage.RequestUri.Segments, "")}")

There is other information in loginSessionResponse.RequestMessage.RequestUri that might make the code shorter or even more robust but it would involve change more code in this file and might need to escape some fields.

There could also be a fall back added to the old server but instead in my usage I detect flaky servers and report them as such.

@benceszasz
Copy link
Contributor Author

@paul1956 I have modified my code yesterday: fa9da38

@paul1956
Copy link

paul1956 commented Jun 30, 2023

@benceszasz thanks, you did a better job then I did I am stealing your implementation. Thanks. Any chance anyone is going to post an explanation of what happened. Medtronic is taking all the heat and phone calls and they really had nothing to do with it.

@benceszasz
Copy link
Contributor Author

@paul1956 it is not stealing, xdrip is GPLv3 :) and there is a good reason why I also wrote and published my xdrip CareLink client solution as an independent java library at the beginning of 2021 also under GPLv3 :)

@paul1956
Copy link

@benceszasz sorry it was mean as a complement. I publish a complete free Windows CareLink data deep dive program on my GitHub account Paul1956 if you want to see everything the pumps really has tables or graphs. You can also export most tables to Excel. There are ~20 tabs of data updated every 1-5 minutes. I did it to understand AIT at first.
image

@benceszasz
Copy link
Contributor Author

@paul1956 I understood and thanks. I was just joking and correcting the word of "stealing", since in this community everyone is working together and share their knowledge and solutions. It is free, so you can't "steal" it :)
Anyway maybe it was a bad joke or the wording was incorrect.

@benceszasz
Copy link
Contributor Author

@paul1956 and also I mentioned my independent java library, because my intention was to make my codes easier to reuse for anyone. But maybe my wording wasn't clear enough, sorry about that, wording in English and proper joking are not one of my strengths.

@Sellyn
Copy link

Sellyn commented Jul 4, 2023

Hi,
I've installed the version from 28.06., but still get the error "CareLink download error! Response code 400. Error message: null". My CareLink Land ist Germany.

@benceszasz
Copy link
Contributor Author

@Sellyn please provide a screenshot of the xdrip system status page (xdrip > menu > system status) and a screenshot of the xdrip Error and Event list (xdrip > three dots menu > Error and Event list).

@Sellyn
Copy link

Sellyn commented Jul 5, 2023

@benceszasz here is a screenshot of the Error list
Screenshot_20230705-161718_xDrip+

@benceszasz
Copy link
Contributor Author

@Sellyn please provide a screenshot of the xdrip system status page (xdrip > menu > system status).

@Sellyn
Copy link

Sellyn commented Jul 5, 2023

@benceszasz: here is my System Status with Version
Screenshot_20230705-173802_xDrip+

@Sellyn
Copy link

Sellyn commented Jul 5, 2023

@benceszasz Now it works. I've changed the password to only 12 chars without special chars, just letters and numbers. Maybe Medtronic can't handle it

@benceszasz
Copy link
Contributor Author

@Sellyn great!
Anyway there was a change after this PR: #2914
This second PR was merged on 29.06.2023, so the latest version of CareLinkFollower is available since the 29.06.2023 version.
Please try the 2023.06.29 version (https://github.com/NightscoutFoundation/xDrip/releases/tag/2023.06.29) or any later version. The last PR is more stable, but in the EU both version should work, the latter is only mandantory for US users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.