PrismarineJS / node-minecraft-protocol

Parse and serialize minecraft packets, plus authentication and encryption.
https://prismarinejs.github.io/node-minecraft-protocol/
BSD 3-Clause "New" or "Revised" License
1.24k stars 239 forks source link

Custom Authentication Function #1025

Open vlouboos opened 2 years ago

vlouboos commented 2 years ago

Is your feature request related to a problem? Please describe. I can't join some servers which use non-vanilla auth

Describe the solution you'd like Add an interface to use own auth-server, like custom auth-lib. Or just simply forward the authentication-packet(hand_shake, login_start)

kashalls commented 2 years ago

What authentication are you talking about? Are you referring to https://github.com/PrismarineJS/node-minecraft-protocol/pull/572 ?

vlouboos commented 2 years ago

Including but also others, like some mc-launchers build a local server for auth when logging in servers, clients call the servers before sending the hand_shake packet, the game profile is returned from the server. The most effective way is to forward the hand_shake and login_start packet to the target server in order to prevent unsupported auth.

vlouboos commented 2 years ago

Another way, use 'authlib.jar' for auth, then give an interface for us to custom using authlib

kashalls commented 2 years ago

I'm against directly putting it minecraft-protocol but I can look into adding an interface for you to do your own authentication. It can be as simple as making auth available as a function so that if you don't set Microsoft or offline, you can handle it your way. Let me look into it.

rob9315 commented 2 years ago

Add an interface to use own auth-server

i can get behind this, there should also be an easy option for using yggdrasil-compatible ('mojang') auth servers by setting the custom /auth endpoint url.

Another way, use 'authlib.jar' for auth, then give an interface for us to custom using authlib

this will not turn into a wrapper of authlib, it's been completely java-free so far and will stay that way

kashalls commented 2 years ago

Add an interface to use own auth-server

i can get behind this, there should also be an easy option for using yggdrasil-compatible ('mojang') auth servers by setting the custom /auth endpoint url.

Another way, use 'authlib.jar' for auth, then give an interface for us to custom using authlib

this will not turn into a wrapper of authlib, it's been completely java-free so far and will stay that way

You can set session server in the client options to change the session server.

rob9315 commented 2 years ago

no, that doesn't work because it's not forwarded to yggdrasil

rob9315 commented 2 years ago

yes, it is, but there is no option for servers

kashalls commented 2 years ago

https://github.com/PrismarineJS/node-minecraft-protocol/commit/60379eb7d2e102c180b425178f8e525fe0417ad6 Solves original issue by exposing an auth function for non-official auth services.