mindstorm38 / portablemc

A fast, reliable and cross-platform command-line Minecraft launcher and API for developers. Including fast and easy installation of common mod loaders such as Fabric, Forge, NeoForge and Quilt.
https://pypi.org/project/portablemc/
GNU General Public License v3.0
320 stars 19 forks source link

Cant login Auth Failed #218

Open AinRyzen opened 1 month ago

AinRyzen commented 1 month ago

Traceback (most recent call last): File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 1344, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1336, in request self._send_request(method, url, body, headers, encode_chunked) File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1382, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1331, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1091, in _send_output self.send(msg) File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1035, in send self.connect() File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1470, in connect super().connect() File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1001, in connect self.sock = self._create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\socket.py", line 828, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\socket.py", line 963, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\site-packages\portablemc\http.py", line 96, in http_request res: HTTPResponse = urllib.request.urlopen(req, context=ctx) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 215, in urlopen return opener.open(url, data, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 515, in open response = self._open(req, data) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 532, in _open result = self._call_chain(self.handle_open, protocol, protocol + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 492, in _call_chain result = func(*args) ^^^^^^^^^^^ File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 1392, in https_open return self.do_open(http.client.HTTPSConnection, req, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 1347, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [Errno 11001] getaddrinfo failed>

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\site-packages\portablemc\auth.py", line 164, in request res = http_request("POST", f"https://authserver.mojang.com/{req}", ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\site-packages\portablemc\http.py", line 103, in http_request raise HttpError(HttpResponse(None), method, url, error) portablemc.http.HttpError: (<HttpResponse 0>, 'POST', 'https://authserver.mojang.com/authenticate', URLError(gaierror(11001, 'getaddrinfo failed')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "i:\Meine Ablage\projekts\VistaLauncher\builds\Vista\test.py", line 15, in version.auth_session = YggdrasilAuthSession.authenticate(clientid, email, password) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\site-packages\portablemc\auth.py", line 144, in authenticate , res = cls.request("authenticate", { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\benno\AppData\Local\Programs\Python\Python312\Lib\site-packages\portablemc\auth.py", line 175, in request raise AuthError(error.res.json()["errorMessage"])


TypeError: 'NoneType' object is not subscriptable
mindstorm38 commented 1 month ago

The Yggdrasil authentication is deprecated and no longer supported by Mojang, I'll probably fix this bad error message, but I can't make it work!

AinRyzen commented 1 month ago

The Yggdrasil authentication is deprecated and no longer supported by Mojang, I'll probably fix this bad error message, but I can't make it work!

Oh, that's unfortunate, I tried the Microsoft Azure logging method, but I don't know what the following variables should have been request_body, id_token, and thus I don't know how I should set up the azure application just in general there is very little information about the Microsoft login in the docs and combining that with the lack of tutorials for this package is really hard to get into portable MC, but I do really appreciate your work and effort that you put into this project

mindstorm38 commented 1 month ago

Ok so you're using the API, to be honest the MS auth bothers me, you can obtain some information on how to set up the Azure APP on https://wiki.vg/Microsoft_Authentication_Scheme, for PortableMC in particular, I suggest that you read this snippet from the CLI, it shows you which URLs and methods to call in order.

AinRyzen commented 1 month ago

Ok so you're using the API, to be honest the MS auth bothers me, you can obtain some information on how to set up the Azure APP on https://wiki.vg/Microsoft_Authentication_Scheme, for PortableMC in particular, I suggest that you read this snippet from the CLI, it shows you which URLs and methods to call in order.

I am just wondering if you saw this part of the wiki, it's almost everything that you have to use for the minecraft authentication, I have to automate this and rewrite your code a bit and I think it would work https://gist.github.com/dewycube/223d4e9b3cddde932fbbb7cfcfb96759 Update: Yesss, it does work

mindstorm38 commented 1 month ago

This is almost what I'm doing in the API, so you should not need to do that manually. https://github.com/mindstorm38/portablemc/blob/eb690c93cd3bb8efbfdf5abd40c4cf85746bb250/portablemc/auth.py#L285-L347