Repository navigation
Sign in and link Google through the Android app's native sheet - #6426
Conversation
|
|
|
Thanks for the PR, @evanpelle! When it's ready for a maintainer to review, comment
See CONTRIBUTING.md for the full process. |
|
No actionable comments were generated in the recent review. WalkthroughAndroid Google login and account linking now use the shell’s native sign-in sheet and submit its ID token. The change adds a typed bridge result, localized error messages, and tests for success, cancellation, and failure cases. Web Google OAuth behavior remains unchanged. ChangesAndroid Google authentication
Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant AuthClient
participant DesktopShell
participant GoogleSignInSheet
participant GoogleAuthAPI
AuthClient->>DesktopShell: Get native sign-in function
DesktopShell->>GoogleSignInSheet: Call google.signIn()
GoogleSignInSheet-->>DesktopShell: Return sign-in result and ID token
DesktopShell-->>AuthClient: Return normalized result
AuthClient->>GoogleAuthAPI: Submit ID token for login or linking
GoogleAuthAPI-->>AuthClient: Return request response
Suggested reviewers: Merge Risk:
|
Google refuses its web OAuth redirect inside a WebView, so in the Android app the Google sign-in and link buttons now take an ID token from the shell's native sheet (window.openfrontDesktop.google.signIn) and post it to /auth/google or /auth/google/link. A successful sign-in reloads into the session the response's refresh cookie set, as the web redirect and magic-link logins do; a successful link reloads with link=google, as the web link flow returns. An Android shell too old to have the sheet is told to update the app instead of being sent to the redirect. The web and the Steam shell are unchanged. Co-Authored-By: Claude Code <noreply@anthropic.com>
cf6d421 to
d641ca1
Compare
🤖 Claude Code ReviewVerdict: No issues found. Findings: 0 critical, 0 major, 0 minor. No issues found. Checked for bugs and CLAUDE.md compliance. Here is what I checked:
|
Description:
Google blocks its web OAuth redirect inside a WebView, so "Sign in with Google" and "Link Google Account" can't work in the Android app today. This makes both buttons use the app shell's native Google sign-in instead.
desktopGoogleSignIn()inDesktopShell.tsdetectswindow.openfrontDesktop.google.signIn, the same way the other optional bridges are detected. It checks what the shell returns: a throw, a malformed result or an error code this client doesn't know all becomefailed.googleLogin()posts the sheet's ID token toPOST /auth/google. On success the page reloads into the session the response's refresh cookie set. That is the same path the web redirect and the magic-link login already use, so nothing else in the client has to know how the player signed in. A 409email_existsshows the existing "sign in to it, then link this account in settings" message, the same one the web shows for that outcome. A dismissed sheet shows nothing. Every other outcome shows a message.linkGoogle()posts the token with the session toPOST /auth/google/link. On success it reloads withlink=google, which is how the web link flow returns, soconsumeLinkResultannounces it and every surface shows the linked account. A 409already_linkedshows the existing "already linked to another player" message.New strings:
account_modal.google_sign_in_{failed,needs_update,no_account,unavailable}.Test plan
tests/DesktopShell.test.ts: bridge detection (no bridge, nogoogle, non-functionsignIn),thisbinding, pass-through of every contract result, andfailedfor an unknown code, a missing, empty or non-string token, an unknown status,null, a string, a rejection and a synchronous throw.tests/client/Auth.desktopLogin.test.ts:credentials: "include", reload),cancelled, each sheet error code,email_exists, and 400/401/500, a 409 with another reason, and a network failurelink=google, reload),already_linked, other refusal,cancelled, and logged out (returns false without opening the sheet)npm test(742 files, 11234 passed, 1 skipped),npm run typecheck,npm run lint,npm run format:checkPlease complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
evan
🤖 Generated with Claude Code