Skip to content

major feat: auth v3#1475

Draft
mattsumi wants to merge 21 commits intosmartcmd:mainfrom
mattsumi:main
Draft

major feat: auth v3#1475
mattsumi wants to merge 21 commits intosmartcmd:mainfrom
mattsumi:main

Conversation

@mattsumi
Copy link
Copy Markdown
Collaborator

@mattsumi mattsumi commented Apr 5, 2026

Description

adds a full authentication system to minecraftconsoles. msft oauth device code flow, yggdrasil-compatible auth (ely.by and any third-party provider via ]yggdrasil.json]), keypair-offline, and plain offline mode. includes server-side enforced auth handshake with an 11-stage protocol, a profile manager with persistent storage, UUID identity system, XUID-to-UUID migration, and configurable [auth-mode] for dedicated servers. also adds libcurl as a dependency for HTTPS, moves nlohmann/json into ]include/Common/vendor], and introduces ]yggdrasil.json] for pluggable third-party auth providers. (for now we are gonna keep the old xuid data, but push it out with a future patch.)

Changes

see new behavior

Previous Behavior

the original codebase was built for consoles where platform-level auth (xbl, psn, etc) handled identity. as we port it to windows, none of this exists, so we are faking this identity. as such, there is no HTTP client to talk to auth servers, no handshake protocol to negotiate authentication schemes, and no UUID system to give players a stable cross-platform identity. the [PreLoginPacket] name field could also overwrite an already-authenticated username which was a pretty obvious security hole once real auth was in place. big no no!!! (also msft store button was going unused.)

before

Root Cause

the original codebase was built for consoles where platform-level auth (Xbox Live, PSN) handled identity. when the project got ported to Windows none of that infrastructure existed, so identity was basically faked. there was no HTTP client to talk to auth servers, no handshake protocol to negotiate authentication schemes, and no UUID system to give players a stable cross-platform identity. the [PreLoginPacket] name field could also overwrite an already-authenticated username which was a pretty obvious security hole once real auth was in place.

New Behavior

players now authenticate through one of four methods. msft (oauth device code flow that opens a browser and polls for completion), yggdrasil (username/password exchange against any yggdrasil-compatible provider — ely.by ships in [yggdrasil.json], mojang is hardcoded as fallback), keypair-offline (local asymmetric keypair auth supporting rsa2048 and ed25519), or offline (trusts users are who they say they are). the server declares which auth scheme it requires via a new [auth-mode[ property ([session] or [offline]), and a full 11-stage handshake protocol ([ANNOUNCE_VERSION] through [AUTH_SUCCESS]/[AUTH_FAILURE]) negotiates and verifies identity before the player ever gets past the login screen.

(funnily enough, msft sees us as minecraft for nintendo switch when autodetected. not bedrock, the original.)

This is now fixed; We are now recognized as Java, as we should have been.

Capture

continuing:

profiles now exist in a binary "auth_profiles.dat" file with token refresh support for both Microsoft and Yggdrasil providers. profiles now track a [variation] field so the system knows which provider issued them. the in-game UI lets you add, remove, cycle through, and apply profiles. players get a [GameUUID] (v5 UUID derived from their identity under the [MinecraftConsoles] namespace) that gets serialized in [LoginPacket] and [AddPlayerPacket]. existing ban/whitelist entries with XUIDs automatically get backfilled with UUIDs on load, and player save files get migrated from XUID-named ".dat" files to UUID-named ones.

the auth module hierarchy was consolidated in v3: [OfflineAuthModule] and [KeypairOfflineAuthModule] got inlined into [AuthModule.h] (separate .cpp/.h files deleted), [SessionAuthModule] was generalized to handle any yggdrasil provider via configurable URLs loaded from [yggdrasil.json], and the old hardcoded ely.by-specific [startElyBy()] flow was replaced with a generic [startYggdrasil()] that takes provider name and auth URL. [ELYBY] profile type became [YGGDRASIL].

if auth fails the client gets a proper [eDisconnect_AuthFailed] disconnect reason with a localized error message instead of just getting silently dropped.

after1 after2

Fix Implementation

the core of this is a new [HttpClient], [AuthModule] hierarchy (session/keypair-offline/offline — all in [AuthModule.h] now), [AuthPackets] (11-stage enum with key-value fields), and a [HandshakeManager] state machine that drives the whole protocol from both sides. [SessionAuthModule] reads provider configs from [yggdrasil.json] at runtime and does full server-side [hasJoined] verification over HTTPS.

[AuthScreen] handles the threaded OAuth/yggdrasil auth flows and profile persistence in a binary [auth_profiles.dat]. [UUID.h/cpp] implements [GameUUID] with a custom SHA-1 for v5 generation, deterministic XUID conversion, and a [MCCONSOLES_NAMESPACE_UUID] constant. on the server side, [PendingConnection] now runs [initAuth()] based on [auth-mode] from [ServerProperties], guards [PreLoginPacket] name overwrites, and disconnects with [eDisconnect_AuthFailed] on failure. [ClientConnection] mirrors this on the client side and syncs the authenticated name back into the platform globals. [DirectoryLevelStorage] handles XUID-to-UUID save file migration, and [BanManager]/[WhitelistManager] backfill UUIDs on load. [UIScene_MainMenu] got the full profile management UI with next/use/add/remove.

AI Use Disclosure

no ai was used to make this

Related Issues

@neoapps-dev

This comment was marked as off-topic.

@Cyber-Sec-DUBLIN

This comment was marked as spam.

@codeHusky
Copy link
Copy Markdown
Collaborator

Please refactor AuthModule, the auth implementations should not be in one large monolithic file. Separate them out.

@codeHusky codeHusky marked this pull request as draft April 5, 2026 18:10
@Firebladedoge229
Copy link
Copy Markdown
Contributor

Firebladedoge229 commented Apr 5, 2026

i dont think we should do this genuinely
the whole point of lce, like what Cyber-Sec-DUBLIN, was to not have any form of microsoft affiliation / authentication in a way
this pr completely ruins that, destroying what we once had

@Firebladedoge229
Copy link
Copy Markdown
Contributor

Firebladedoge229 commented Apr 5, 2026

this also just gives microslop the opportunity to suspend anyone who uses the fork in the first place
in what world does this make sense?? we're quite literally just telling microslop atp: "HEY IM DOING SOMETHING ILLEGAL!!! PLEASE TAKE ACTION AGAINST MY ACCOUNT ACCORDINGLY!!!!”

@funnyfella42

This comment was marked as off-topic.

@codeHusky
Copy link
Copy Markdown
Collaborator

Please keep conversation in this PR related to the contents of the PR and concerns about things being introduced in this PR.

@mattsumi mattsumi changed the title major feat: auth v2 major feat: auth v3 Apr 6, 2026
@codeHusky
Copy link
Copy Markdown
Collaborator

From defnotsomeguy2 on Discord

So i noticed a small inconsistancy with the ui, its the auth button (no this isnt about the authentication system itself), so every other option in the main menu is atleast a full word or 2 even, but auth is not so it feels kinda out of place, our idea is that we could change it, when you open the game for the first time or if you dont have an account, itll display as "Sign in" and once youve already logged in, itll say "Switch User" incase you have any other accounts, essentially, a dynamic button, and im not sure how the auth button as of now works but im 99 precent certain itll probably still say auth even after you sign in, which doesnt make too much sense, especially when you consider the real console releases did simalliar things with this system, i just think it would add to consistancy and make it abit more user friendly

@mattsumi
Copy link
Copy Markdown
Collaborator Author

mattsumi commented Apr 6, 2026

From defnotsomeguy2 on Discord

So i noticed a small inconsistancy with the ui, its the auth button (no this isnt about the authentication system itself), so every other option in the main menu is atleast a full word or 2 even, but auth is not so it feels kinda out of place, our idea is that we could change it, when you open the game for the first time or if you dont have an account, itll display as "Sign in" and once youve already logged in, itll say "Switch User" incase you have any other accounts, essentially, a dynamic button, and im not sure how the auth button as of now works but im 99 precent certain itll probably still say auth even after you sign in, which doesnt make too much sense, especially when you consider the real console releases did simalliar things with this system, i just think it would add to consistancy and make it abit more user friendly

i agree with the sentiment, so i made the change!

switchuser

@Emerald-Fox
Copy link
Copy Markdown

this also just gives microslop the opportunity to suspend anyone who uses the fork in the first place in what world does this make sense?? we're quite literally just telling microslop atp: "HEY IM DOING SOMETHING ILLEGAL!!! PLEASE TAKE ACTION AGAINST MY ACCOUNT ACCORDINGLY!!!!”

this also just gives microslop the opportunity to suspend anyone who uses the fork in the first place in what world does this make sense?? we're quite literally just telling microslop atp: "HEY IM DOING SOMETHING ILLEGAL!!! PLEASE TAKE ACTION AGAINST MY ACCOUNT ACCORDINGLY!!!!”

I have a question about this, would Microsoft actually know you're using the leaked LCE source code for this? I've seen tons of other software such as Prism Launcher allow you to login to you Minecraft account and there's been no issues that I've heard of, the login application doesn't need to specify that it's for logging into this and could be something simple like, "ConsoleLogin". Overall I don't think the login would need to send info to Microsoft telling them what you're logging into, correct me if I'm wrong.

@mattsumi
Copy link
Copy Markdown
Collaborator Author

mattsumi commented Apr 6, 2026

I have a question about this, would Microsoft actually know you're using the leaked LCE source code for this? I've seen tons of other software such as Prism Launcher allow you to login to you Minecraft account and there's been no issues that I've heard of, the login application doesn't need to specify that it's for logging into this and could be something simple like, "ConsoleLogin". Overall I don't think the login would need to send info to Microsoft telling them what you're logging into, correct me if I'm wrong.

No.

It just says "Minecraft Launcher."

No more details are provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants