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

DoesNotOwnMinecraftError within auth_session.refresh() #193

Open dakiba opened 6 months ago

dakiba commented 6 months ago

Some user get now the DoesNotOwnMinecraftError Exception, then they want refresh the session:

        from portablemc.fabric import FabricVersion
        from portablemc.standard import Context

        if data.get("auth_mails").get(email, {}).get("auth"):
            auth_session = data.get("auth_mails").get(email, {}).get("auth")
            if not auth_session.validate():
                auth_session.refresh()
Traceback (most recent call last):
  File "site-packages\portablemc\http.py", line 95, in http_request
  File "urllib\request.py", line 222, in urlopen
  File "urllib\request.py", line 531, in open
  File "urllib\request.py", line 641, in http_response
  File "urllib\request.py", line 569, in error
  File "urllib\request.py", line 503, in _call_chain
  File "urllib\request.py", line 649, in http_error_default
urllib.error.HTTPError: HTTP Error 404: Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\portablemc\auth.py", line 323, in authenticate_base
  File "site-packages\portablemc\auth.py", line 349, in mc_request_profile
  File "site-packages\portablemc\http.py", line 98, in http_request
portablemc.http.HttpError: (<HttpResponse 404>, 'GET', 'https://api.minecraftservices.com/minecraft/profile', <HTTPError 404: 'Not Found'>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "minecraft.py", line 121, in start
  File "site-packages\portablemc\auth.py", line 226, in refresh
  File "site-packages\portablemc\auth.py", line 326, in authenticate_base
portablemc.auth.DoesNotOwnMinecraftError

Line 121 is the auth_session.refresh()

dakiba commented 6 months ago

Reset the session didn't worked. After we did login to the mojang website in the browser, the error was gone. We had now 2 users with that issue. Microsoft is so ......

mindstorm38 commented 6 months ago

I'm afraid of Microsoft API honestly