MCPHackers / LaunchWrapper

Launch wrapper for legacy Minecraft
MIT License
21 stars 3 forks source link

[MultiMC/PrismLauncher] [macOS] Release 1.0.0+: Failed to verify username! #7

Closed ChampionCynthia closed 2 months ago

ChampionCynthia commented 10 months ago

Tested using Minecraft 1.1 on MultiMC 0.7.0 and PrismLauncher 8.0, macOS 10.14 Mojave.

Java:

$ java -version
openjdk version "1.8.0_392"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_392-b08)
OpenJDK 64-Bit Server VM (Temurin)(build 25.392-b08, mixed mode)

Problem

LaunchWrapper is run with:

--username <User> --session token:<ACCESS TOKEN>:<PROFILE ID> --gameDir /path/to/MultiMC/instances/1.1-1/.minecraft --assetsDir /path/to/MultiMC/instances/1.1-1/.minecraft/resources --resourcesProxyPort 11707 --skinProxy pre-1.8 --forceVsync

The game's log seems to confirm that both the username and the access token are forwarded to the game:

Setting user: <User>, token:<ACCESS TOKEN>:<PROFILE ID>

Yet, trying to connect to a Minecraft server with online-mode=true fails:

[INFO] Disconnecting <User> [/127.0.0.1:53603]: Failed to verify username!

The username is correct and skins work though.

I can connect just fine without LaunchWrapper (with and without the Betacraft proxies).

It should be noted that MultiMC doesn't replace existing libraries like LWJGL with MCPHackers's version.

Cause

Using tcpdump, I determined that when run with LaunchWrapper, the client doesn't send anything to session.minecraft.net. The server actually accepts the connection but the client cannot verify itself and bails out.

Without LaunchWrapper:

# Client
127.0.0.1 > session.minecraft.net: HTTP: GET /game/joinserver.jsp?user=<User>&sessionId=<sessionId>&serverId=<serverId> HTTP/1.1
session.minecraft.net > 127.0.0.1: HTTP: HTTP/1.1 200 OK

# Server
127.0.0.1 > session.minecraft.net: HTTP: GET /game/checkserver.jsp?user=<User>&serverId=<serverId>
session.minecraft.net > 127.0.0.1: HTTP: HTTP/1.1 200 OK

With LaunchWrapper:

# Server only!
127.0.0.1 > session.minecraft.net: HTTP: GET /game/checkserver.jsp?user=<User>&serverId=<serverId>
session.minecraft.net > 127.0.0.1: HTTP: HTTP/1.1 200 OK

I know that the wrapper is programmed to properly make the query in LegacyURLStreamHandler.java:

if(path.equals("/game/joinserver.jsp"))
    return super.openConnection(new URL("http", "session.minecraft.net", path));

so I'm not sure as to where the bug lies.

Lassebq commented 2 months ago

Duplicate of #5. However, it should be fixed now with latest commit. Please test