ammaraskar / pyCraft

Minecraft-client networking library in Python
Other
817 stars 184 forks source link

"Invalid credentials" after logging in with pyCraft (Original title: "WARNING!") #162

Closed XyperCode closed 4 years ago

XyperCode commented 4 years ago

I used this, it's probably a scam. I used this for authenticating and out of nowhere my password changed! I'm not sure of this package did this, or https://github.com/AlphaBs/pml Any help?

XyperCode commented 4 years ago

Hmmm, it could be that someone has my password. I will close it.

ammaraskar commented 4 years ago

That is most likely what happened. This is an open source project, you can see exactly what happens with the password here:

https://github.com/ammaraskar/pyCraft/blob/ff9a0813b64a0afdf3cd089ad9000350bb4122bc/start.py#L72

https://github.com/ammaraskar/pyCraft/blob/ff9a0813b64a0afdf3cd089ad9000350bb4122bc/minecraft/authentication.py#L88

XyperCode commented 4 years ago

OK, I changed my password, changed the password in config of my code and run minecraft more times. And nothing happens... LOL

XyperCode commented 4 years ago

So, it was the problem that exactly when I run Minecraft, that my password was changed after 10 seconds of previous authetication. Probably a hacker or someone who knows my password. Nothing wrong with this package.

XyperCode commented 4 years ago

Here is what i made with this package, tkinter and pmlaucher: If you are interested.

Schermopname (49)

Btw, sorry for the issue, I was in panic.

XyperCode commented 4 years ago

Whaaat??? It's happening again! I'm done with this

joodicator commented 4 years ago

@Qboi123 I suspect that you are falling foul of this peculiar behaviour of Mojang's authentication server:

Error Cause Error Message Notes
... ... ... ...
ForbiddenOperationException Invalid credentials. Too many login attempts with this username recently (see /authenticate). Note that username and password may still be valid!
... ... ... ...

Source: https://wiki.vg/Authentication#Errors

In practice, it is necessary to cache the authentication tokens returned from the server to avoid having the account temporarily blocked due to to many login attempts. A system to facilitate this in pyCraft was suggested, but work on that has not progressed recently, so for now you could do something like I do in this project that uses pyCraft: https://github.com/joodicator/mcchat2/blob/463fc05075008b476f3d62e1ef23f44587251c94/mcchat2.py#L774-L796

XyperCode commented 4 years ago

You mean you just save the token? Seems like a good idea if the token is not temporary.

joodicator commented 4 years ago

@Qboi123 The token expires after some time, but the idea is that if the token has expired, you request a new one, thereby limiting the frequency of login requests.

XyperCode commented 4 years ago

OK

XyperCode commented 4 years ago

Btw, it was caused when I was testing the code.