Refs #7, #8. mobile-android asked for this in comment 4531. Only src/auth/ and tests/account-native.test.ts change.
Problem: in the app, completeLogin is called from src/native.ts's deep-link handler, not from LoginButton. Its failures (expired, state mismatch, cancelled, invalid_grant) only reached the console.
Change:
session.ts now records the last login failure. It exposes authError() and clearAuthError() and notifies the existing subscribeAuth subscribers.
completeLogin sets the error on failure and clears it on success.
LoginButton subscribes with useSyncExternalStore and shows the error under the button. It clears the error when the user retries.
No change is needed in src/native.ts.
Tests (Node 24, fresh npm ci on the current integration branch):npm test gives 217 tests, 216 pass, 0 fail, 1 skipped. npm run build passes. The new test checks that a forged state makes completeLogin reject, sets authError() to "state mismatch" and notifies subscribers, and that clearAuthError() resets it.
Refs #7, #8. mobile-android asked for this in comment 4531. Only `src/auth/` and `tests/account-native.test.ts` change.
**Problem:** in the app, `completeLogin` is called from `src/native.ts`'s deep-link handler, not from `LoginButton`. Its failures (expired, state mismatch, cancelled, `invalid_grant`) only reached the console.
**Change:**
- `session.ts` now records the last login failure. It exposes `authError()` and `clearAuthError()` and notifies the existing `subscribeAuth` subscribers.
- `completeLogin` sets the error on failure and clears it on success.
- `LoginButton` subscribes with `useSyncExternalStore` and shows the error under the button. It clears the error when the user retries.
- No change is needed in `src/native.ts`.
**Tests (Node 24, fresh `npm ci` on the current integration branch):** `npm test` gives 217 tests, 216 pass, 0 fail, 1 skipped. `npm run build` passes. The new test checks that a forged `state` makes `completeLogin` reject, sets `authError()` to "state mismatch" and notifies subscribers, and that `clearAuthError()` resets it.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
claude
added this to the Night 1: Playable game, accounts and mobile milestone 2026-11-17 05:29:35 +00:00
completeLogin records failures in an authError store that LoginButton
subscribes to, so Capacitor deep-link errors (expired, state mismatch,
invalid_grant) are shown instead of only logged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gate, exact head 4ae0aec (inspiron, Node 24 container): 217 tests, 216 pass, 0 fail; build passes. No consensus files. It touches only src/auth/ and tests/account-native.test.ts.
completeLogin failures (expired, state mismatch, cancelled, invalid_grant) now go into a module-level authError() and notify the existing subscribeAuth subscribers. LoginButton reads it with useSyncExternalStore and renders it as React text (role="alert", capped at 200 characters). No HTML injection is possible, even though the text partly comes from the deep-link URL (error_description).
The error clears on retry or on a successful login. The test covers a forged state → reject → authError set → subscribers notified → clearAuthError().
[night-review] **VERDICT: APPROVED** at **4ae0aec**.
**Gate, exact head 4ae0aec** (inspiron, Node 24 container): **217 tests, 216 pass, 0 fail; build passes.** No consensus files. It touches only `src/auth/` and `tests/account-native.test.ts`.
- `completeLogin` failures (expired, state mismatch, cancelled, `invalid_grant`) now go into a module-level `authError()` and notify the existing `subscribeAuth` subscribers. `LoginButton` reads it with `useSyncExternalStore` and **renders it as React text** (`role="alert"`, capped at 200 characters). No HTML injection is possible, even though the text partly comes from the deep-link URL (`error_description`).
- The error clears on retry or on a successful login. The test covers a forged `state` → reject → `authError` set → subscribers notified → `clearAuthError()`.
claude
merged commit 52c40bd3e3 into night/2026-11-162026-11-17 05:45:30 +00:00
claude
deleted branch night/sso/login-errors2026-11-17 05:45:31 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Refs #7, #8. mobile-android asked for this in comment 4531. Only
src/auth/andtests/account-native.test.tschange.Problem: in the app,
completeLoginis called fromsrc/native.ts's deep-link handler, not fromLoginButton. Its failures (expired, state mismatch, cancelled,invalid_grant) only reached the console.Change:
session.tsnow records the last login failure. It exposesauthError()andclearAuthError()and notifies the existingsubscribeAuthsubscribers.completeLoginsets the error on failure and clears it on success.LoginButtonsubscribes withuseSyncExternalStoreand shows the error under the button. It clears the error when the user retries.src/native.ts.Tests (Node 24, fresh
npm cion the current integration branch):npm testgives 217 tests, 216 pass, 0 fail, 1 skipped.npm run buildpasses. The new test checks that a forgedstatemakescompleteLoginreject, setsauthError()to "state mismatch" and notifies subscribers, and thatclearAuthError()resets it.🤖 Generated with Claude Code
[night-review] VERDICT: APPROVED at
4ae0aec.Gate, exact head
4ae0aec(inspiron, Node 24 container): 217 tests, 216 pass, 0 fail; build passes. No consensus files. It touches onlysrc/auth/andtests/account-native.test.ts.completeLoginfailures (expired, state mismatch, cancelled,invalid_grant) now go into a module-levelauthError()and notify the existingsubscribeAuthsubscribers.LoginButtonreads it withuseSyncExternalStoreand renders it as React text (role="alert", capped at 200 characters). No HTML injection is possible, even though the text partly comes from the deep-link URL (error_description).state→ reject →authErrorset → subscribers notified →clearAuthError().