MrKinau / FishingBot

1.8 - 1.21 Fishing bot for Minecraft
GNU General Public License v3.0
322 stars 68 forks source link

Add auth token-based login, as well as command-line flags and usage #48

Closed sudofox closed 4 years ago

sudofox commented 4 years ago

I keep getting my IP tempbanned by Mojang's auth service from logging in to Minecraft. I've done a lot of work with Minecraft automation in the past and the solution is always the same: switch to using authentication tokens. I built a tool to help automate and manage this: https://github.com/sudofox/minecraft-alt-manager

Now, along with being able to simply pass an authentication token to the bot to avoid unnecessary re-auths (it tries to auth over and over again if it fails which quickly worsens the length of the auth ban), it would be excellent to have a full set of command line flags I can use to override the config file.

For example:

-c  --config        Path to config file (default: config.properties)
-u  --username      Account username or email
-p  --password      Account password
-t  --token     Auth token (overrides username/password)
-h  --server-ip     Server IP
-P  --server-port   Server Port

This way you can put all your preferred config stuff into your config file and override it with command-line flags.

MrKinau commented 4 years ago

well to make sure I understand you: You want to send the accesstoken (which normally get received by /authenticate endpoint) to the bot? And skip the whole /authenticate step? Or do you want the bot somehow to use the /refresh endpoint?

MrKinau commented 4 years ago

okay, applied accestokens should be checked viá /validate and if they are not valid they can get a /refresh or you have to /authenticate again.

sudofox commented 4 years ago

Yes, that's right. Access tokens can be reused over and over indefinitely, but logging in every time can get you tempbanned/ratelimited by Mojang if you do it a lot or do it for many accounts, so reusing the auth token is much preferable.

I want to generate my own access token with my account manager and use that when starting the bot by passing it as a flag.

MrKinau commented 4 years ago

a long time ago, but got implemented in the latest release (at least the thing with the access tokens), everything else should already be implemented or kind of implemented.