Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"mojang.errors.NotFound: HTTP 404. This resource does not exist." On login with bearer token #38

Open
ghost opened this issue Mar 11, 2023 · 4 comments

Comments

@ghost
Copy link

ghost commented Mar 11, 2023

When trying to login with a bearer token, It throws a 404 not found error.
This is my code, i am trying to use 2 accounts:

        try:
            client1 = Client("EMAIL", "PASS")
        except errors.LoginFailure:
            QtWidgets.QMessageBox.about(self, "Error", "Invalid main account")
            return

        try:
            client2 = Client(bearer_token = "TOKEN")
        
        except errors.LoginFailure:
            QtWidgets.QMessageBox.about(self, "Error", "Invalid second account")
            return

It should be a valid token. Its 435 characters long and contains a dot.

@summer
Copy link
Owner

summer commented Mar 12, 2023

Hi, I've tried to replicate this issue but it's not happening for me. Is there anything different about the Minecraft account?

Can you check if it happens when you use this code?

from mojang import Client

client = Client("EMAIL", "PASS")

client2 = Client(bearer_token=client.bearer_token)

Also, have you tried enabling debug mode?

from mojang import Client

client = Client(bearer_token="BEARER_TOKEN", debug_mode=True)

If you can find out the specific endpoint that's returning a HTTP 404, that would help.

@ghost
Copy link
Author

ghost commented Mar 12, 2023

First of all. thanks for your response @summer.

I have now switched to using 2 accounts with email:pass and without the token.
But i am still getting a 404 error.

The account(s) are XBOX life if this makes a difference.

@gtvCH
Copy link

gtvCH commented Aug 22, 2023

This error occurs, when you use a brand-new account which has no name set yet. Client instantiation is not possible. Traceback:

Traceback (most recent call last):
  File "/home/username/test.py", line 7, in <module>
    client = Client("email", "password")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mojang/client.py", line 63, in __init__
    self._validate_session()
  File "/usr/lib/python3.11/site-packages/mojang/client.py", line 95, in _validate_session
    if not self._has_minecraft_profile():
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mojang/client.py", line 75, in _has_minecraft_profile
    resp = self.request("get", f"{_BASE_API_URL}/minecraft/profile")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mojang/_http_client.py", line 84, in request
    raise NotFound
mojang.errors.NotFound: HTTP 404. This resource does not exist.

(To avoid misunderstanding: It seems to be a bug in the library, not in the code of @MatrixByt3s)
Hope this helps to fix the bug :)

@ProtDos
Copy link

ProtDos commented Aug 25, 2024

Hey. I found the answer to why this is. This is when the user has not set a username yet / is a fresh account. I'll maybe open a pull request for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants