Skip to content

fix(auth): fetch server-issued login code via GET /LoginCode - #3

Open
falhenaki wants to merge 1 commit into
OKJID:macos-portfrom
falhenaki:fix/login-server-issued-code
Open

fix(auth): fetch server-issued login code via GET /LoginCode#3
falhenaki wants to merge 1 commit into
OKJID:macos-portfrom
falhenaki:fix/login-server-issued-code

Conversation

@falhenaki

Copy link
Copy Markdown

Problem

Online login never completes on this macOS port. The browser shows "Welcome Back, " but the game reports login failed and returns to the menu.

Root cause

The GeneralsOnline services backend now issues and registers login codes server-side (GET /LoginCodePendingLoginManager.AddPendingLogin). CheckLogin returns result:2 (HTTP 403) for any code the server didn't issue, and the web/Discord callback's POST /LoginCode only updates a pre-registered code.

This client still generated the gamecode locally (GenerateGamecode()) and never called GET /LoginCode, so:

  • the code was never registered;
  • CheckLogin returned result:2 on the very first poll (instant "login failed");
  • the browser still showed "Welcome Back" because the Discord OAuth half succeeds independently — which makes it look like a broken account rather than a client bug.

Result: online login could never complete on this port.

Fix

Add BeginInteractiveLogin(): fetch the server-issued code via GET /LoginCode, then use that code for the browser URL and CheckLogin polling. BeginLogin (no cached refresh token) and DoReAuth now route through it. This matches the upstream GeneralsOnlineDevelopmentTeam client flow. Self-contained; macOS browser-open path (open) preserved.

Verification (against api.playgenerals.online, prod)

  • GET /LoginCodeCheckLogin = result:0 (WAITING), not 403
  • after completing Discord auth → result:1 (SUCCESS) with session/refresh tokens + ws_uri
  • control: an unregistered locally-generated code still → result:2 (403)

Built clean for the macOS target.

@falhenaki
falhenaki force-pushed the fix/login-server-issued-code branch from 1b32321 to 372b282 Compare August 29, 2026 03:49
The GeneralsOnline services backend registers login codes server-side
(GET /LoginCode -> PendingLoginManager.AddPendingLogin) and only accepts a
code it issued: the web/Discord callback's POST /LoginCode updates a
pre-registered code, and CheckLogin returns FAILED (HTTP 403) for any code
the server never issued.

This client generated the gamecode locally (GenerateGamecode) and never
called GET /LoginCode, so the code was never registered. CheckLogin then
returned result:2 on the first poll while the browser still showed
"Welcome Back" (the Discord OAuth half succeeds independently), which looks
exactly like a broken account. Online login could never complete.

Add BeginInteractiveLogin(): fetch the code from the server, then use it for
the browser URL and CheckLogin polling. BeginLogin (no cached token) and
DoReAuth now route through it, matching the upstream GOD Team client.

Verified against api.playgenerals.online: GET /LoginCode -> CheckLogin
result:0 (WAITING) -> result:1 (SUCCESS) after Discord auth; an unregistered
local code still returns result:2.
@falhenaki
falhenaki force-pushed the fix/login-server-issued-code branch from 372b282 to edfa9fe Compare August 29, 2026 03:51
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.

1 participant