francescotescari / XiaoMiToolV2

XiaomiTool V2 - Modding tool for xiaomi devices
https://www.xiaomitool.com
Apache License 2.0
627 stars 124 forks source link

Xiaomi procedure failed: [getServiceToken] Missing serviceToken cookie #23

Closed rodrgz closed 2 years ago

rodrgz commented 3 years ago

I followed the instructions to unlock my Xiaomi phone, but I found this procedure error in the current linux version and in the Windows version.

Screenshot from 2021-07-13 09-35-19

saleksandarz commented 2 years ago

I'm reproducing it

@erikrodrgz do you have lts kernel or current? I think that fastboot is somehow incompatible with arch or we are missing some driver or something.

rodrgz commented 2 years ago

Actually I'm using 5.13.13-zen1-1-zen. I don't know if it's a kernel problem.

On Mon, Sep 6, 2021 at 7:21 PM saleksandarz @.***> wrote:

I'm reproducing it

@erikrodrgz https://github.com/erikrodrgz do you have lts kernel or current?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/francescotescari/XiaoMiToolV2/issues/23#issuecomment-913821311, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM3C4PDWWHGNZOWKFKWVZCLUAUIEJANCNFSM5AJAWLSQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

saleksandarz commented 2 years ago

@erikrodrgz solved the issue today by using usb hub. all commands from fastboot worked without any problem. xiaomitoolv2 worked too. I suppose something is wrong in arch with usb setup.

S-Paul commented 2 years ago

Hello again. Many thanks to author and all, i successfully unlock my rn10pro and install LOS! :)

frankgumeta commented 2 years ago

Hi guys, I have a question for you. I have followed the steps in all the thread but I receive this error. Do you know what I'm missing?. I'm running on a M1 Mac mini if that helps. The error happens in the last step. When I try to unlock the device. Everything else went well (login, device recognition, etc...)

Screen Shot 2021-09-09 at 2 22 24 p m

By the way, someone knows how to fix this as well 😅?.

Screen Shot 2021-09-09 at 2 22 03 p m

WolkoMichel commented 2 years ago

Hi guys ! Is it possible for one of you who succeded with the manipulation (modifiing the authentification method) to create the .jar file and to upload it somewhere ? I'm trying to compile the solution but it doesn't work (i've never used gradle before)

Thanks in advance

morfikov commented 2 years ago

Is there a HOWTO on how to do the jar/run file? I could do it, but I have no idea how.

ahmadraniri1994 commented 2 years ago

Sorry, if this is a silly question. I got this error, did I mess up something? Thanks

Project : => no module-info.java found

S-Paul commented 2 years ago

[QUOTE]

Hi guys, I have a question for you. I have followed the steps in all the thread but I receive this error. Do you know what I'm missing?. I'm running on a M1 Mac mini if that helps. The error happens in the last step. When I try to unlock the device. Everything else went well (login, device recognition, etc...)

Screen Shot 2021-09-09 at 2 22 24 p m

By the way, someone knows how to fix this as well sweat_smile?.

Screen Shot 2021-09-09 at 2 22 03 p m [/QUOTE] Try to "LANG=C" in console first.

S-Paul commented 2 years ago

Hi guys ! Is it possible for one of you who succeded with the manipulation (modifiing the authentification method) to create the .jar file and to upload it somewhere ? I'm trying to compile the solution but it doesn't work (i've never used gradle before)

Thanks in advance

Do you proceed README? Do you install propper JAVA? Show console output.

S-Paul commented 2 years ago

Is there a HOWTO on how to do the jar/run file? I could do it, but I have no idea how.

./gradlew build ./gradlew run ?

S-Paul commented 2 years ago

Sorry, if this is a silly question. I got this error, did I mess up something? Thanks

Project : => no module-info.java found

Is dependencies installed? openjdk-11-jre:amd64 && openjdk-11-jre-headless:amd64 etc?

ahmadraniri1994 commented 2 years ago

Sorry, if this is a silly question. I got this error, did I mess up something? Thanks

Project : => no module-info.java found

Is dependencies installed? openjdk-11-jre:amd64 && openjdk-11-jre-headless:amd64 etc?

yeah, I have it.

[ahmad@LIDG ~]$ pacman -Qs jre local/jre-openjdk 16.0.2.u7-1 OpenJDK Java 16 full runtime environment local/jre-openjdk-headless 16.0.2.u7-1 OpenJDK Java 16 headless runtime environment local/jre11-openjdk 11.0.12.u7-1 OpenJDK Java 11 full runtime environment local/jre11-openjdk-headless 11.0.12.u7-1 OpenJDK Java 11 headless runtime environment

nocturn9x commented 2 years ago

Just an update to confirm that I was able to unlock my device (Xiaomi Mi 11i, codename haydn) succesfully and I'm now going to install TWRP and Magisk. Thanks a lot to everyone who helped fix this!

WolkoMichel commented 2 years ago

The jar file is the result of the compilation. To run it you need

Hi guys ! Is it possible for one of you who succeded with the manipulation (modifiing the authentification method) to create the .jar file and to upload it somewhere ? I'm trying to compile the solution but it doesn't work (i've never used gradle before) Thanks in advance

Do you proceed README? Do you install propper JAVA? Show console output.

This is the cause of the errors :

Caused by: java.lang.RuntimeException: java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x605d5ad0) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module j dk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x605d5ad0

Caused by: java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x605d5ad0) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x605d5ad0

I only modified the authentification method and nothing else.

saleksandarz commented 2 years ago

Try java version 11

ahmadraniri1994 commented 2 years ago

Sorry, if this is a silly question. I got this error, did I mess up something? Thanks

Project : => no module-info.java found

Fixed by changing / setting default java to 11 version.

aaron0791 commented 2 years ago

Sorry, if this is a silly question. I got this error, did I mess up something? Thanks

Project : => no module-info.java found

Fixed by changing / setting default java to 11 version.

Hey man, i am having the same exact issue I get this:

`./gradlew build

Configure project : Project : => no module-info.java found

Task :compileJava FAILED Note: /home/aaron0791/Downloads/XiaoMi/XiaoMiToolV2/src/main/java/com/xiaomitool/v2/tasks/AdbPushTask.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.

FAILURE: Build failed with an exception.

BUILD FAILED in 1s 1 actionable task: 1 executed `

I have no idea what to do. You said you fixed your issue by changing / setting default java to 11 version, I am running java 16. Could you please tell me how to do this?

drnguyenn commented 2 years ago

I have just tried to install and use the official Mi Unlock Tool on Windows and noticed that it required 2FA (phone verification) when signing in. Maybe Xiaomi has updated its authentication policy that caused this problem.

WolkoMichel commented 2 years ago

Sorry, if this is a silly question. I got this error, did I mess up something? Thanks

Project : => no module-info.java found

Fixed by changing / setting default java to 11 version.

Hello again,

I tried with Java 11, but the result of the build is the same... I tried on differents IDE and different Java version.

Do you have any idea what's wrong ?

Is it possible for you to upload the .jar file ?

Thanks in advance

coomac commented 2 years ago

Has anyone tried this recently? Built with no issues, but the SMS verification code I receive is flagged as invalid on both linux and a windows vm.

Edit: I was able to log in using a VPN that placed me in the US, then had to disable the VPN to request the unlock token. Still need to wait for one week.

MagicFab commented 2 years ago

Tried this tonight on Ubuntu Mate 20.04 LTS, it worked just fine.

image

In Ubuntu 20.04 :

  1. sudo apt install git openjdk-11-jre openjdk-11-jdk gradle - I am not sure all of this is required
  2. git clone https://github.com/francescotescari/XiaoMiToolV2.git && cd XiaoMiToolV2 && git checkout linux
  3. cd XiaoMiToolV2
  4. Edit line 39 of src/main/java/com/xiaomitool/v2/gui/controller/LoginController.java, change it to: private static final String LOGIN_URL = "https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi&json=false&passive=true&hidden=false&_snsDefault=facebook&checkSafePhone=true&_locale=" + Locale.getDefault().getLanguage().toLowerCase();
    1. ./gradlew build && ./gradlew run
    2. I chose "Global" region and logged in, it required 2FA to be sent to the phone. 2FA entry form didn't quite fit the window but I was able to enter the code and authenticate, then after a warning screen it showed the above confirmation.
kbuss commented 2 years ago

Tried this tonight on Ubuntu Mate 20.04 LTS, it worked just fine.

image

In Ubuntu 20.04 :

1. `sudo apt install git openjdk-11-jre openjdk-11-jdk gradle` - I am not sure all of this is required

2. `git clone https://github.com/francescotescari/XiaoMiToolV2.git && cd XiaoMiToolV2 && git checkout linux`

3. `cd XiaoMiToolV2`

4. Edit line 39 of `src/main/java/com/xiaomitool/v2/gui/controller/LoginController.java `, change it to:
   `private static final String LOGIN_URL = "https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi&json=false&passive=true&hidden=false&_snsDefault=facebook&checkSafePhone=true&_locale=" + Locale.getDefault().getLanguage().toLowerCase();`

5. `./gradlew build && ./gradlew run`

6. I chose "Global" region and logged in, it required 2FA to be sent to the phone. 2FA entry form didn't quite fit the window but I was able to enter the code and authenticate, then after a warning screen it showed the above confirmation.

This worked for me on Arch Linux. Thank you!

polyeto commented 2 years ago

Tried this tonight on Ubuntu Mate 20.04 LTS, it worked just fine.

image

In Ubuntu 20.04 :

1. `sudo apt install git openjdk-11-jre openjdk-11-jdk gradle` - I am not sure all of this is required

2. `git clone https://github.com/francescotescari/XiaoMiToolV2.git && cd XiaoMiToolV2 && git checkout linux`

3. `cd XiaoMiToolV2`

4. Edit line 39 of `src/main/java/com/xiaomitool/v2/gui/controller/LoginController.java `, change it to:
   `private static final String LOGIN_URL = "https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi&json=false&passive=true&hidden=false&_snsDefault=facebook&checkSafePhone=true&_locale=" + Locale.getDefault().getLanguage().toLowerCase();`

5. `./gradlew build && ./gradlew run`

6. I chose "Global" region and logged in, it required 2FA to be sent to the phone. 2FA entry form didn't quite fit the window but I was able to enter the code and authenticate, then after a warning screen it showed the above confirmation.

Worked with me in Linux Mint 21, thanks!

lsnch commented 2 years ago

For others on MacOS with font issues, use 11.0.8. 11.0.12 can't produce fonts, while later versions changed their apis too much. The easiest way to do this is to get a tar.gz from Oracle (you'll have to register a throwaway account) and direct your script there like this: JAVA_HOME=/Users/you/Downloads/jdk-11.0.8.jdk/Contents/Home ./gradlew run

nildeveloper commented 2 years ago

image login and confirm 2FA but not success.....

MagicFab commented 2 years ago

This happened to me twice, just retry.

federico-calandra commented 2 years ago

Tried this tonight on Ubuntu Mate 20.04 LTS, it worked just fine.

image

In Ubuntu 20.04 :

1. `sudo apt install git openjdk-11-jre openjdk-11-jdk gradle` - I am not sure all of this is required

2. `git clone https://github.com/francescotescari/XiaoMiToolV2.git && cd XiaoMiToolV2 && git checkout linux`

3. `cd XiaoMiToolV2`

4. Edit line 39 of `src/main/java/com/xiaomitool/v2/gui/controller/LoginController.java `, change it to:
   `private static final String LOGIN_URL = "https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi&json=false&passive=true&hidden=false&_snsDefault=facebook&checkSafePhone=true&_locale=" + Locale.getDefault().getLanguage().toLowerCase();`

5. `./gradlew build && ./gradlew run`

6. I chose "Global" region and logged in, it required 2FA to be sent to the phone. 2FA entry form didn't quite fit the window but I was able to enter the code and authenticate, then after a warning screen it showed the above confirmation.

Hello, even if this issue is closed I try to write here. I have followed this steps without success. For a lot of people it worked, and they got the bootloader unlocked. I have tried both on Windows and Linux. I cannot get it because the program gives me this error

Unlocking bootloader failed, Xiaomi server returned error 20044: Error description: Unknown error: 20044 Server description: Invalid fastboot token Please retry or upgrade your unlock tool.

Obviously no chance if I try it again. I would appreciate it evry much if anyone could help me. Thank you!

edd34 commented 2 years ago

has anybody openned a PR to fix this ?

nazarewk commented 2 years ago

image login and confirm 2FA but not success.....

I'm getting this exact issue too, already used up 4 attempt always getting that weird JSON-like response and not logging in.

callmeraxz commented 2 years ago

Hi guys! I tried the methods by @d3417 @morfikov @andresangelini and I get this error... I am not as techy as you guys please help me someone!

`> Task :compileJava FAILED

FAILURE: Build failed with an exception.

BUILD FAILED in 2s 1 actionable task: 1 executed `

galakhov commented 2 years ago

For others on MacOS with font issues, use 11.0.8. 11.0.12 can't produce fonts, while later versions changed their apis too much. The easiest way to do this is to get a tar.gz from Oracle (you'll have to register a throwaway account) and direct your script there like this: JAVA_HOME=/Users/you/Downloads/jdk-11.0.8.jdk/Contents/Home ./gradlew run

I was able to unlock the bootloader on macOS by following the steps from these two posts + fixing the reported issue on line 39: https://github.com/francescotescari/XiaoMiToolV2/issues/23#issuecomment-924575903 https://github.com/francescotescari/XiaoMiToolV2/issues/23#issuecomment-928428415

I've described the detailed steps here: https://forum.xda-developers.com/t/tool-win-lin-mac-miunlocktool-unlock-bootloader-of-xiaomi-devices-on-mac-linux.3782444/page-13#post-85932539

dportalesr commented 2 years ago

Hello! I've followed all the steps described here for Mac OS but I'm getting this message instead of the waiting period for unlock. image

My phone is soft-bricked so I cannot do what they suggest. Any ideas?

scorninpc commented 2 years ago

The problem still happening

image

image

image

image

What can i be doing wrong?

federico-calandra commented 2 years ago

I had this same issue.  I don't know what is it caused by but I managed to unlock my phone using MiFlash 5.5.224. Actually I don't remeber where I downloaded it from, I guess you can find it by doing a little search on the internet

Inviato da Yahoo Mail su Android

Il lun, 6 dic, 2021 alle 14:01, Bruno Pitteli @.***> ha scritto:

The problem still happening

What can i be doing wrong?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

asteven commented 2 years ago

Note that the fix from #26 was only merged in the main branch. If you're on linux you'll have to cherry pick the commit from the main branch to the linux branch.

e.g.

% git show a335da6
commit a335da6bb812272d68d6842ff88c4b7552465cc4 (HEAD -> master, origin/master, origin/HEAD)
Author: Vasilis Mavromatis <8668731+vmavromatis@users.noreply.github.com>
Date:   Tue Oct 5 14:17:00 2021 +0300

    fix: update API params (#26)

diff --git a/src/main/java/com/xiaomitool/v2/gui/controller/LoginController.java b/src/main/java/com/xiaomitool/v2/gui/controller/LoginController.java
index c90bb86..026aed9 100644
--- a/src/main/java/com/xiaomitool/v2/gui/controller/LoginController.java
+++ b/src/main/java/com/xiaomitool/v2/gui/controller/LoginController.java
@@ -36,7 +36,7 @@ import java.net.URI;
 import java.util.Locale;

 public class LoginController extends DefaultController {
-    private static final String LOGIN_URL = "https://account.xiaomi.com/pass/serviceLogin?sid=passport&json=false&passive=true&hidden=false&_snsDefault=facebook&_locale=" + Locale.getDefault().getLanguage().toLowerCase();
+private static final String LOGIN_URL = "https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi&json=false&passive=true&hidden=false&_snsDefault=facebook&checkSafePhone=true&_locale=" + Locale.getDefault().getLanguage().toLowerCase();
     private static boolean loggedIn = false;
     private static Thread loginThread = null;
     @FXML
%
% git checkout linux
% git cherry-pick a335da6
[linux da038f0] fix: update API params (#26)
 Author: Vasilis Mavromatis <8668731+vmavromatis@users.noreply.github.com>
 Date: Tue Oct 5 14:17:00 2021 +0300
 1 file changed, 1 insertion(+), 1 deletion(-)
% gradle build
% gradle run
scorninpc commented 2 years ago

Yes, i know that, but not working

image

image

quisys commented 2 years ago

Yes, i know that, but not working

image

image

Build and run it again. As long as you ran the cherry-pick command it will work.

mardy commented 2 years ago

I tried this on linux, but the application crashes when I click the "Login" button: https://paste.ubuntu.com/p/CFsDVHzF89/

It looks like it's some JDK/Webkit incompatibilities. I'm on Ubuntu 20.04.

Edit: upgrading to gradle 6.8.3 seems to solve the issue :-)

scorninpc commented 2 years ago

I found my problem. This works only with SMS validation. Facebook login doesn't work

Rarian50 commented 2 years ago

I tried #23, the "missing token error" vanished, and a F2A process was successfully initiated. But finally the unlock failed with error 20031, same as #40. Was anyboy able to unlock via #23 in past 3 weeks ? If not we have to assume, that the workaround is no longer possible.

AnatomicJC commented 2 years ago

Tried this tonight on Ubuntu Mate 20.04 LTS, it worked just fine.

@MagicFab Thanks man, you saved my day !! You're awesome :tada:

satanas17 commented 2 years ago

Tried this tonight on Ubuntu Mate 20.04 LTS, it worked just fine.

image

In Ubuntu 20.04 :

1. `sudo apt install git openjdk-11-jre openjdk-11-jdk gradle` - I am not sure all of this is required

2. `git clone https://github.com/francescotescari/XiaoMiToolV2.git && cd XiaoMiToolV2 && git checkout linux`

3. `cd XiaoMiToolV2`

4. Edit line 39 of `src/main/java/com/xiaomitool/v2/gui/controller/LoginController.java `, change it to:
   `private static final String LOGIN_URL = "https://account.xiaomi.com/pass/serviceLogin?sid=unlockApi&json=false&passive=true&hidden=false&_snsDefault=facebook&checkSafePhone=true&_locale=" + Locale.getDefault().getLanguage().toLowerCase();`

5. `./gradlew build && ./gradlew run`

6. I chose "Global" region and logged in, it required 2FA to be sent to the phone. 2FA entry form didn't quite fit the window but I was able to enter the code and authenticate, then after a warning screen it showed the above confirmation.

Worked for me on my Poco X3 Pro Thanks a lot

omarolmos81 commented 2 years ago

I followed the instructions to unlock my Xiaomi phone, but I found this procedure error in the current linux version and in the Windows version.

Screenshot from 2021-07-13 09-35-19

Amigo, yo solucione el problema de la siguiente forma:

1.- Entras a la pagina https://unlock.update.miui.com 2.- Lo ejecutas en modo de administrador el que dice batch_unlock.exe en windows 3.- Pones tu equipo en FastBoot que es con el boton de encendido y volumen abajo. 4.- En el programa le das siguiente y si es apto por las horas, te lo desbloquea, ami el xiaomitool v2 no lo pudo realizar pero este si.

Espero te sirva.

Nearz99 commented 2 years ago

image

Nearz99 commented 2 years ago

but after using official unlock tool i get 168 days to wait

Nearz99 commented 2 years ago

image

morfikov commented 2 years ago

hours != days

chir-set commented 2 years ago

I'm having the 'Missing serviceToken cookie' on lInux with Xaomi 11 Lite 5G NE. Tried with the packaged version and with dev 'Linux' branch. Edited 'LoginController.java'. Built with gradlew. Still unsuccesful. Is there some other tweak to do ? Thanks for any input.

Kalucher commented 2 years ago

I'm having the 'Missing serviceToken cookie' on lInux with Xaomi 11 Lite 5G NE. Tried with the packaged version and with dev 'Linux' branch. Edited 'LoginController.java'. Built with gradlew. Still unsuccesful. Is there some other tweak to do ? Thanks for any input.

Me still having the same issue. I've done all that as well but same Missing Service Token error...

Edit: I've found out there that Find my device should be activated in Mi Account setting in order to unlock bootloader. I done it but still having same issue :(

This is starting to be a pain in the a** xD

Could anyone give us an alternative? Thank you

Working on Linux as well (Manjaro KDE). MUIU version 12.5