Skip to content

fix(freemilk): finish Google login by pasting the redirect URL - #683

Merged
caigee-cmd merged 1 commit into
mainfrom
fix/freemilk-login-flow
Dec 6, 2026
Merged

caigee-cmd merged 1 commit into
mainfrom
fix/freemilk-login-flow

Conversation

@caigee-cmd

Copy link
Copy Markdown
Owner

Why

#681 sent the browser through a 127.0.0.1 /launch page and expected the Google redirect to come back to /oauth2callback. The redirect registered for the app's Google client is a custom scheme (com.googleusercontent.apps...:/oauth2callback), so the browser never reaches the loopback listener. On a server deployment 127.0.0.1 is not the operator's browser either. Polling therefore waited until the 10 minute timeout.

What

  • StartLogin returns the Google authorization URL directly (S256 PKCE, same client and redirect as the app).
  • Login completes through CompleteLogin: the operator pastes the com.googleusercontent.apps...:/oauth2callback?code=... URL, the state must match the pending login, and the code is exchanged and stored on the account.
  • PollLogin only reports whether the pending login is still alive.
  • Removed auth.ServeSchemeBridge, the freemilk loopback listener, and failPending (it marked an arbitrary pending login as failed).
  • Console wizard shows FreeMilk-specific paste instructions (en/zh). Static assets synced.

Checked against a Proxyman capture of the app's successful login

  • Google /token request parameters match.
  • /auth/google from the app also carries an Apple device_check_token; this change still omits it. A fake identity token got Invalid Google identity token (not a DeviceCheck rejection), but a real token has not been tried. Needs production acceptance.

Tests

go test ./... passes; tsc -b and npm run sync clean.

The app's Google client only accepts its custom-scheme redirect, which no
local listener can receive, and 127.0.0.1 is not the operator's browser when
the console runs on a server. The login link now opens Google directly and
CompleteLogin exchanges the pasted code with the pending PKCE verifier.

Removes the unreachable scheme bridge and the failPending logic that marked
an arbitrary pending login as failed. The wizard shows FreeMilk-specific
paste instructions.
@caigee-cmd
caigee-cmd merged commit e426e0d into main Dec 6, 2026
6 checks passed
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