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

Invalid Session error when playing LAN with Offline accounts #44

Closed
1 task done
imsamuka opened this issue Dec 15, 2022 · 28 comments
Closed
1 task done

Invalid Session error when playing LAN with Offline accounts #44

imsamuka opened this issue Dec 15, 2022 · 28 comments
Labels
bug Something isn't working

Comments

@imsamuka
Copy link

imsamuka commented Dec 15, 2022

Operating System

Linux

Version of PollyMC

PollyMC 6.0

Version of Qt

Qt 6.4.1

Description of bug

Can't connect to a 1.7.10 LAN server. It gives this message:

connection error message

Steps to reproduce

  1. Create a (1.7.10) instance.
  2. Run to download libraries.
  3. Close and copy the instance.
  4. Run both instances at once with 2 different accounts.
  5. Create a world in one of the open games.
  6. Start a LAN server.
  7. Try to connect to the LAN server using the other game.

Suspected cause

I tried and i can connect fine using PolyMC 1.4.3 (the aur cracked version, that was apparently removed). So the problem was probably introduced on PrismLauncher or PollyMC.

Relevant logs:

...
[20:13:56] [Client thread/INFO]: Started on 41401
[20:13:56] [Client thread/INFO]: [CHAT] Local game hosted on port 41401
[20:14:05] [Server thread/INFO]: com.mojang.authlib.GameProfile@6b44a2cf[id=<null>,name=imsamuka2,properties={},legacy=false] (/127.0.0.1:48198) lost connection: Disconnected

Also, by opening the server on a PolyMC (1.4.3) instance, and trying to connect using PollyMC, the log is the same.

But by doing the inverse, open the server on PollyMC, and using a PolyMC to connect, the connection works fine.

I couldn't test in the Prismlauncher, since i don't own a account yet; So i posted the issue here...

This issue is unique

  • I have searched the issue tracker and did not find an issue describing my bug.
@imsamuka imsamuka added the bug Something isn't working label Dec 15, 2022
@fn2006
Copy link
Owner

fn2006 commented Dec 16, 2022

What account type are you using?
I'm going to bed now but I'll take a look at this when I have time tomorrow.

@imsamuka
Copy link
Author

Offline account.

@imsamuka
Copy link
Author

Also, i forgot to comment: once, the log said something about receiving the wrong amount of data in the packets. I'll search for the log file containing the message.

@imsamuka
Copy link
Author

I got a friend of mine to test this on PrismLauncher. It works fine, so it's really a PollyMC issue.

@imsamuka
Copy link
Author

I found the log file. Note that this was in a modded session of 1.7.10, so it's not absolutely clear if it can be used to track the issue.

...
[18:11:49] [Client thread/INFO]: Started on 33725
[18:11:49] [Client thread/INFO]: [CHAT] Local game hosted on port 33725
[18:16:59] [Server thread/INFO]: com.mojang.authlib.GameProfile@56adce2b[id=<null>,name=MyFriendUsername,properties={},legacy=false] (/127.0.0.1:41960) lost connection: Internal Exception: io.netty.handler.codec.DecoderException: java.io.IOException: Packet was larger than I expected, found 14 bytes extra whilst reading packet 0
...

@ComradeWave
Copy link

@imsamuka What version of Java are you using? I think there might be connectivity issues in some Java versions compatible with 1.7.10, you could try this version of Java.

@imsamuka
Copy link
Author

Java 1.8.0_352

But how could this be the issue? Since both instances are running the same version of Java?

@imsamuka
Copy link
Author

imsamuka commented Dec 16, 2022

I'm sick of this, i bought a microsoft minecraft account. But i still have to solve the issue, because my friend doesn't have one.

I found a lead to the problem; when you create a Offline account in the Accounts window, if you try to connect to a LAN server with it, it fails. When you use a Microsoft account on offline mode and select a different name, you can connect correctly.

The catfromplan9 "PolyMC-Cracked" fork didn't had this issue, so i think it must be some implementation error in the DRM check removal. Unfortunately his repo is not available anymore, and i can't find a copy anywhere to see how he did it. I found a copy of the repo. Turns out, it can't connect to LAN servers either, but it can connect to normal servers (with online-mode=false).

But it's still an unresolved issue, since as i said before, when you use a Microsoft account on offline mode, you can connect.
What "Microsoft account on offline mode" have that "Offline account" doesn't?

I'll test the "PolyMC-Offline" fork too and test some things, if it works, i'll submit a PR here

@fn2006
Copy link
Owner

fn2006 commented Dec 16, 2022

Sorry I took a while to get back to you, I've done some testing myself and I can reproduce the issue.

What I've found is that offline accounts can't join each others LAN games but they can join online-mode=false servers, interestingly microsoft accounts can join offline accounts' LAN games but offline accounts can't join microsoft accounts' LAN games.

What's even stranger is I remember this used to work fine but I downloaded an older version of Polly but it gave me the same invalid session error.

I'll keep digging and try to figure out how to fix this.

What "Microsoft account on offline mode" have that "Offline account" doesn't?

I think this will probably be a big clue in fixing it.

@imsamuka
Copy link
Author

older version of Polly

@fn2006 Maybe we can pinpoint the issue with git bisect then?

@fn2006
Copy link
Owner

fn2006 commented Dec 16, 2022

Nah, it turns out I was misremembering and offline account LAN never worked, me and my friend were actually using ely.by accounts on LAN.

@fn2006
Copy link
Owner

fn2006 commented Dec 16, 2022

Alright, I've found the problem but I'm not sure how to go about fixing it.
1.7.7 started enforcing online-mode=true for LAN games, if you try to play LAN with offline accounts on 1.7.6 or older then it works perfectly.

Personally I would just use ely.by accounts.

@imsamuka
Copy link
Author

I see, using https://www.curseforge.com/minecraft/mc-mods/server-properties-for-lan and enforcing online-mode=false solves the problem too. But how can Microsoft accounts Offline work?

@fn2006
Copy link
Owner

fn2006 commented Dec 17, 2022

I'm not sure, the launcher doesn't seem to handle microsoft accounts in offline mode that differently to offline mode accounts so I'd guess that even though the username's been changed everything else is still valid so the game lets it in.

@fn2006 fn2006 changed the title Failed to Login: Invalid Session Invalid Session error when playing LAN with Offline accounts Dec 17, 2022
@imsamuka
Copy link
Author

What you mean by everything else? There's any way to mimick it?

@fn2006
Copy link
Owner

fn2006 commented Dec 20, 2022

I mean things like the UUID, access token, etc.
Since online-mode=true means that everything is verified on Mojang's servers it's impossible to fool by sending fake data that's in the right format.

@fn2006 fn2006 pinned this issue Dec 20, 2022
@imsamuka
Copy link
Author

I see. So I assume that the only workaround is a mod on the Host game, or using versions before 1.7.6 then.

@yum13241
Copy link

I remember back when I was 9 or smth, using TLauncher (ik it's a virus now) on 1.12.2 and it worked fine. (might be irrelevant)

On PollyMC, I can join 2 Ely.by accounts or a mix and match. The host always used an Ely.by account. I was using modded 1.12.2. Both machines were on Linux and use the pollymc-bin package from the AUR.

@LegendaryGW
Copy link

The mod linked earlier in this thread seems to have its latest version for 1.12.2. I was able to find another mod for later versions
(https://www.curseforge.com/minecraft/mc-mods/lan-server-properties)
However, when I tried LAN with online mode turned off, it still gave me the same invalid session error.
So is the only fix for now to use ely.by accounts?

@MIOGMIOG
Copy link

I remember back when I was 9 or smth, using TLauncher (ik it's a virus now) on 1.12.2 and it worked fine. (might be irrelevant)

On PollyMC, I can join 2 Ely.by accounts or a mix and match. The host always used an Ely.by account. I was using modded 1.12.2. Both machines were on Linux and use the pollymc-bin package from the AUR.

thats because tlauncher launches game in offline mode, but IIRC pollymc emulates auth server

@yum13241
Copy link

yum13241 commented Jul 11, 2023

PollyMC should only be redirecting the game to Ely.by auth servers with an ely.by account. It shouldn't be doing what UltimMC does.

EDIT: PollyMC 8.0 now does what UltimMC does. (It uses authlib-injector).

@Hexality
Copy link

image

@evan-goode
Copy link
Contributor

@Hexality that seems to be #63

@offbeat-stuff
Copy link

fabric mc seems to working on fix for 1.16.5 on their dev environments.

@offbeat-stuff
Copy link

FabricMC/fabric-loom#915

@offbeat-stuff
Copy link

So the only way to fix this issue is to make accounts on a alternative server, gotcha

@Darukutsu
Copy link

https://github.com/satxm/mcwifipnp this fixes it for me

@yum13241
Copy link

Yes, because it can enforce online-mode=false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants