CareLink Follower - CarePartner app authentication #3210
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
Auth token is only valid for 1-3 hours, if it cannot refreshed for exmaple due to lack of internet connection, a new login must be carried out manually.
Solution
CarePartner app authentication is valid for 1 week, thus even if xdrip is unable to connect to CareLink for a few days (for example due to the lack of internet connection), it will be able to renew the login (refresh the token) automatically in the background after it can connect to CareLink again without needing to login again manually using the browser. The user account restriction applies to this authentication process as well: a different dedicated follower account must be used in every app, otherwise the previous auth token will be revoked.
Credits
CarePartner app authentication process is based on the impressive work of @palmarci in extracting the entire authentication process of the mobile app.
Limitations
When the same account is logged in from another xdrip or official mobile application the previous login will be closed (authetication token is revoked). A different dedicated follower account must be used in every official and xdrip app, otherwise the previous auth token will be revoked.
Testing
I have tested it with all kinds of accounts (patient, carepartner) with different devices (standalone CGM and 7xxG pump) in every region (EU,US) on different phones and it is was working fine without any errors and was stable.