Warning! This is pure bleeding edge, but at least it somehow gets the token.
Fuck Microsoft. Why does everything has to be complicated...
The code should be executed with valid microsoft credentials.
The first argument in the console must be the email of the microsoft account. The second argument must be the password of the microsoft account.
The code will print an error since it tries to connect to the localhost server. If the localhost server is up the bot will try to connect and the program must be exited with ^C.