barneygale / quarry

Python library that implements the Minecraft network protocol and data types
Other
527 stars 75 forks source link

Added bearer token authentication method #185

Open louis-e opened 1 year ago

louis-e commented 1 year ago

This fork implements a bearer login method as described by @Jerrylum in https://github.com/barneygale/quarry/issues/135#issuecomment-1088143509.

Usage: python script.py --bearer-token "<BEARER_TOKEN>" server.com

See https://kqzz.github.io/mc-bearer-token/ for more informations about how to obtain the bearer token.

ChillerDragon commented 3 months ago

Thanks for this patch! It worked for me. I tested with the client_messenger.py example on a 1.19.2 vanilla server.

python ./client_messenger.py --bearer-token eyJdoNtSteaLmyTokEn 127.0.0.1

On the server side I had to add the following to my server.properties

enforce-secure-profile=false

Otherwise I would get the following error in the server log.

[04:03:47] [Server thread/INFO]: com.mojang.authlib.GameProfile@1fa6d0e[id=434c9f3c-abc9-3e19-a340-1a2e31b6964c,name=xxx,properties={textures=[com.mojang.authlib.properties.Property@7559c9cc]},legacy=false] (/8.1.26.19:60440) lost connection: Missing profile public key.
This server requires secure profiles.

And this error in the quarry client log

Kicked: multiplayer.disconnect.missing_public_key

But that seems to be an unrelated issue that those secure profiles are not supported by quarry.

louis-e commented 3 months ago

Thanks for the feedback, that's nice to hear! :)

Since I'm not an active contributor to this project due to missing time and missing knowledge I can't really provide a fix for this, but like you said it's likely that this is something on Microsoft's side anyway. Maybe someone else can contribute to this.

Liebe Grüße :)