PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
5.08k stars 921 forks source link

Microsoft sign in for brand new accounts #1480

Closed satyamedh closed 3 years ago

satyamedh commented 3 years ago

Is your feature request related to a problem? Please describe.

Yup, I recently got a minecraft acct(woooo), but I needed to use a microsoft account. this means my mojang acct dosent own minecraft, but my microsoft does. Is there a way I can use mineflayer with my microsoft account?

Describe the solution you'd like

a way to login into the bot using a microsoft account

Describe alternatives you've considered

There is no alternatives I can think of.

Additional context

start implementing quickly, as migration is coming soon.

PS: MIGRATION HASNT BEGUN, ANY ACCOUNT BROUGHT AFTER DEC 1ST WILL BE BOUGHT ON A MICROSOFT ACCOUNT! This also means no cape for me ;(

satyamedh commented 3 years ago

woah, sorry for the caps in the lats line, didnt see I had caps lock on!

satyamedh commented 3 years ago

@rom1504 can u help me with a alternative?

rom1504 commented 3 years ago

you can check https://github.com/PrismarineJS/node-minecraft-protocol/issues/782

satyamedh commented 3 years ago

Oof, aight then, Imma try and figure it out. maybe use something like tokens?(github has it, why not microsoft accts)

satyamedh commented 3 years ago

Hmmn, I think i can use the accessToken in launcher_accounts.json file. can u tell me how to use that? @rom1504

for protocols Imma just use wireshark

Karang commented 3 years ago

You can try with this PR https://github.com/PrismarineJS/node-minecraft-protocol/pull/787 it will probably be reviewed and merged tomorrow though.

extremeheat commented 3 years ago

launcher_profiles is no longer used when doing ms auth, it instead (at least for now) writes to launcher_accounts.json in a similar format. Although I’m hearing that this information may be encrypted in the future.

extremeheat commented 3 years ago

cc @peterix re: taking tokens from launcher_accounts.json

satyamedh commented 3 years ago

@extremeheat I am using launcher accounts, check my comment again. @Karang uhh I didnt get what that pr does

satyamedh commented 3 years ago

aight, https://github.com/PrismarineJS/node-minecraft-protocol/pull/787/commits/3a4b6c41a3a5acc7ff0657adfed00f3b40d8698a should do it. Imma try it once merged.

satyamedh commented 3 years ago

That is revert -_-

extremeheat commented 3 years ago

Want @peterix’s opinion on this as it was mentioned this is bad, but as a temporary solution until mojang releases an auth library, we could use the launcher account database in the new launcher_accounts.json file as the account db for node-minecraft-protocol. When using a Xbox account, instead of passing in a username and password, the user can pass in an xuid and a path to launcher_accounts.json or the directory containing it and we lookup the access token from there and use it for the auth process. In launcher accounts, we can look up the xuid against the “remoteId” and use that to fire out which access token to use. PrismarineJS/node-Minecraft-protocol#787 may need some revisions here: I don’t believe launcher (at least the latest version) uses launcher_profiles anymore for mojang accounts either, deleting auth info from there still allows the launcher to sign in. It seems to be just used for game version profiles now. This would make it easy to allow for multiple accounts, as you can store multiple logins in the launcher now.

rom1504 commented 3 years ago

now supported, just put auth:'microsoft' in createBot options (thanks @Kashalls)

satyamedh commented 3 years ago

@rom1504 Thanks!(I didnt check notifications till now lmao)