offici5l / MiUnlockTool

MiUnlockTool developed to retrieve encryptData(token) for Xiaomi devices for unlocking bootloader, It is compatible with all platforms.
Apache License 2.0
289 stars 17 forks source link

Can't get token after logging in #34

Closed Guybrush3pw00d closed 6 months ago

Guybrush3pw00d commented 6 months ago

My best regards. I'm stuck with the dreaded "device not activated" error (apart from the fact that activating hasn't ever been a compulsory step while just binding under developer options has always been enough, my device is correctly activated instead) arisen only after waiting for the time asked by Xiaomi and I've tried to install miunlock according to the guidelines. I log in with Mi account only after launching the script and, just to be on the safe side, I start with a browser with empty cache. Tried three different browsers too (Kiwi, Fennec and Soul) with the same outcome. After logging in, I get no confirmation page with the token in its address but just errors (401 with Kiwi and Fennec, net::ERR_HTTP_RESPONSE_CODE_FAILURE with Soul) at this address. If I try to paste that address, miunlock says it can't find the token there but I'm not surprised given that I'm leaving the path very well outlined in the documentation. Considering, I've strictly adehered to the setup and usage guidelines, I tend to exclude errors on my side and so I do with a bug in the script itself so I believe Xiaomi has changed something, again, to prevent users from successfully unlocking bootloaders. Have a nice day! :)

offici5l commented 6 months ago

code 10013 = This device is not activated, please activate it and try to unlock it again”.

As for the "401" Just update MiUnlockTool Thanks to @Zoxorer 🙏

Please tell me the result

I tried that a few moments ago

~~When verifying via phone number, the problem does not occur The problem only occurs via mail verification !!~~

I don't know why Xiaomi wants to prevent this !!

I know that some users face a problem in obtaining the verification code via phone number Whether through the official Xiaomi tool or other tools Do not worry, I found a way to bypass this. I will modify the code later While waiting for this, ...

Thanks

Zoxorer commented 6 months ago

is the link that appears in the browser like this?? https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi don't wait for it to open automatically, try to open this link manually in your browser. this is actually wrong generated link

just open this link in the browser and login correctly: https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi&checkSafeAddress=true&passive=false&hidden=false

The error is in this line:

if "wb_id" not in data:
    input("\nPress Enter to open confirmation page, copy link after seeing {\"R\":\"\",\"S\":\"OK\"}, and return here\n\n\033[1;33mNotice:\nIf logged in with any account in your default browser,\nplease log out before pressing Enter.\033[0m\n\n")
    conl = 'https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi&checkSafeAddress=true&passive=false&hidden=false'
    if s == "Linux":
        os.system("xdg-open " + conl)

this can happen because the “&” symbol conflicts with the symbol in the bash syntax when the link is combined with “xdg-open” in os.system() and because the “&” symbol assumes the next thing will be run in the background

it should be like this: $ xdg-open 'https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi&checkSafeAddress=true&passive=false&hidden=false' when os.system() and bash syntax execute the link with xdg-open

offici5l commented 6 months ago

@Zoxorer This is thanks to you https://github.com/offici5l/MiUnlockTool/blob/main/MiUnlockTool.py#L129 issue has been corrected

I thought the problem was from Xiaomi !😅

Thank you again🙏

Guybrush3pw00d commented 6 months ago

@Zoxorer, @offici5l

Thanks to you both! :) Now it works perfeclty. Unfortunately, it doesn't solve my issue (and the one many others are experiencing according to what can be found around with a simple search) but this is another matter, nothing related to something wrong with MiUnlockTool but something which Xiaomi has purposedly put there to prevent users from unlocking. :( On the other hand, thanks to your contribution, what's to be expected here has been achieved so the issue can be marked as solved therefore be closed.