samolego / SimpleAuth

Simple authentication mod for Fabric or Forge servers.
https://modrinth.com/mod/SimpleAuth
MIT License
39 stars 15 forks source link

Premium AutoLogin not working correctly #63

Closed DeadKper closed 3 years ago

DeadKper commented 3 years ago

I think this feature is not working as intended or my other mods or proxy is messing with it, I tried loggin with an offline client with the same name of a premium account on my server and it logged like I was a premium user (not asking for password), if any info is needed just ask, I don't really know what can be helpful but I'm using a velocity proxy with offline mode disable but enabled online on the fabric-proxy mod and on the fabric server and it asked to register using an offline account and it didn't with my premium account, but when I opened a offline client with the same name as my premium account it didn't ask to register o login even when using session at 1 second timeout, don't know if the session has something to do with it, also tried another premium account names using an offline client and the same happened

Originally posted by @DeadKper in https://github.com/samolego/SimpleAuth/issues/23#issuecomment-824714340

samolego commented 3 years ago

Could you enable debug mode in config and then try the procedure again? What does the log say?

DeadKper commented 3 years ago

Where can I see the logs? also, there's a feature called "hackOnlineMode" on the proxylite.toml config, if I turn it off and try to set the server on online mode and also activate premiumAutologin feature, it rejects to connect, doesn't matter if it's an offline or online client, maybe that feature has something to do with it

Edit: there is a little message on the console saying "Not migrating deadkper, as premium status is: false and data file is present." when the online mode is off, autologin is on and hackonlineclient is on(on fabricproxy-lite), but if I enable online mode (even without proxy or any other mod) I cannot log in with an offline client

samolego commented 3 years ago

I cannot log in with an offline client

does the client have the name which is taken by any minecraft player already? If so, that's to be expected

DeadKper commented 3 years ago

With only simpleauth installed, online mode on and autologin on Not migrating deadkper, as premium status is: true and data file is present. that's with my premium client, and then User com.mojang.authlib.GameProfile@4f797bc[id=,name=DeadFake,properties={},legacy=false] (/) has disconnected, reason: Disconnected for the offline client, it doesn't even get to the mod and disconnects the offline client because is in online mode

Here's the console messages

23.04 07:21:03 [Server] User Authenticator #1/INFO UUID of player DeadKper is 223948e3-c3a8-444f-a9db-a8ff3725d406
23.04 07:21:03 [Server] Server thread/INFO Not migrating deadkper, as premium status is: true and data file is  present.
23.04 07:21:03 [Connect] User DeadKper, IP <ip>
23.04 07:21:03 [Multicraft] DeadKper ran command Message of the Day
23.04 07:21:03 [Server] Server thread/INFO DeadKper joined the game
23.04 07:21:14 [Disconnect] User com.mojang.authlib.GameProfile@4f797bc[id=<null>,name=DeadFake,properties={},legacy=false] (/<ip>) has disconnected, reason: Disconnected

Also, DeadFake is not taken as far as I know

samolego commented 3 years ago

https://namemc.com/search?q=DeadFake

DeadKper commented 3 years ago

Yep, just tried with the name 1_TEST2NAME3 and it logs in normally, mcskinsearch didn't show results on DeadFake don't know why, and seems like hackonlinemode is required for the mod to work correctly, now it logs in normally, but the problem with an offline client using the same name as my premium account, log in without password remains, is it because is the same ip?

DeadKper commented 3 years ago

The problem is the proxy, tried a bunch of things and as soon as I tried using the proxy something breaks even when I made it work a couple minutes ago without it, should I leave this issue open?

hackonlinemode on -> offline clients can join with a premium name with no issues hackonlinemode off -> can't join with any premium name on offline or online clients

samolego commented 3 years ago

but the problem with an offline client using the same name as my premium account, log in without password remains, is it because is the same ip?

humm, shouldn't be if you've disabled sessions ...

DeadKper commented 3 years ago

Tried using a different name and disabling sessions but it still logs in, the name I tried was "ElTedii", but DeadFake refuses to log in unless I force it to be offline in the configs

DeadKper commented 3 years ago

I think hackonlinemode forces an offline client to use the online uuid and maybe it says to the server "Hey, this user is actually a verified mojang account", and maybe that's what causes the problem?, because if that's the case I don't think this can be "fixed"

samolego commented 3 years ago

I sadly have no idea how it works ... But if that's the case, client should still be disconnected ...

DeadKper commented 3 years ago

Closed it by accident, actually, should I close this? I think I know the problem, the proxy basically makes any user a "premium" user if it has a premium name, using no mods with hackonlinemode (on fabric proxy) and with online mode (on the sv settings) when I try to enter the server with an offline client with a premium name (like DeadKper or ElTedii, just to clarify I don't have the account for my friend Tedii) it logs in with no problem, so when your mod tries to check if it's an offline user it doesn't work, and I don't know how but I made it work with hackonlinemode off, tried a bunch of things and it worked somehow, but some of my friends can't log in since they like to use their nicknames for other games wich are actually taken, and if I try to do a forceofflineuuids and I have hackonlinemode off nothing works for premium users, at least not on my host, I'll try later on my pc if I can find any solution or if it's just the host

samolego commented 3 years ago

Yeah, this can be closed then.