bimmerconnected / bimmer_connected

🚘 Library to query the status of your BMW or Mini from the ConnectedDrive portal
Apache License 2.0
365 stars 79 forks source link

China login #534

Closed Yixi closed 1 year ago

Yixi commented 1 year ago

Proposed change

Add a new nonce algorithm for the China region login, automatically complete the login graphic verification code, restore the login function for the China region, and update the refresh token method.

Type of change

Additional information

Due to the public disclosure of the x-login-nonce algorithm in the Chinese region, the logic has been added to the library. Currently, password login requires a graphical captcha.

The solution we have incorporated allows for automatic bypassing of the graphical captcha obtained from https://gitee.com/cvnc/BMW/blob/master/lib/BMWLogin.js

The refresh token also needs to be included in the header with the x-login-nonce encoded using gcid.

image

Checklist

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (6a5f292) 100.00% compared to head (af63d8a) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #534 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 18 18 Lines 1447 1475 +28 ========================================= + Hits 1447 1475 +28 ``` | Flag | Coverage Δ | | |---|---|---| | 3.10 | `100.00% <100.00%> (ø)` | | | 3.11 | `100.00% <100.00%> (ø)` | | | 3.7 | `100.00% <100.00%> (ø)` | | | 3.8 | `100.00% <100.00%> (ø)` | | | 3.9 | `100.00% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bimmerconnected#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://app.codecov.io/gh/bimmerconnected/bimmer_connected/pull/534?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bimmerconnected) | Coverage Δ | | |---|---|---| | [bimmer\_connected/api/authentication.py](https://app.codecov.io/gh/bimmerconnected/bimmer_connected/pull/534?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bimmerconnected#diff-YmltbWVyX2Nvbm5lY3RlZC9hcGkvYXV0aGVudGljYXRpb24ucHk=) | `100.00% <100.00%> (ø)` | | | [bimmer\_connected/api/regions.py](https://app.codecov.io/gh/bimmerconnected/bimmer_connected/pull/534?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bimmerconnected#diff-YmltbWVyX2Nvbm5lY3RlZC9hcGkvcmVnaW9ucy5weQ==) | `100.00% <100.00%> (ø)` | | | [bimmer\_connected/api/utils.py](https://app.codecov.io/gh/bimmerconnected/bimmer_connected/pull/534?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bimmerconnected#diff-YmltbWVyX2Nvbm5lY3RlZC9hcGkvdXRpbHMucHk=) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

rikroe commented 1 year ago

To make the refresh token work, we will need to store gcid in the HA registry as well.