Skip to content

fix: prevent silent reauth in non-teacher/devlogin mode and use lightweight refresh#487

Merged
takaokouji merged 3 commits into
developfrom
fix/devlogin-relogin
Apr 11, 2026
Merged

fix: prevent silent reauth in non-teacher/devlogin mode and use lightweight refresh#487
takaokouji merged 3 commits into
developfrom
fix/devlogin-relogin

Conversation

@takaokouji
Copy link
Copy Markdown

Summary

3つの問題を修正:

1. devlogin / 生徒モードで Google One Tap が表示される

  • attemptSilentReauth に mode ガードを追加
  • mode !== 'teacher' または ?devlogin パラメータがある場合はスキップ

2. 30秒リフレッシュで入力内容がクリアされる

  • 自動リフレッシュを loadClassroomDetail(全データ更新)から refreshMembersOnly(メンバー一覧のみ更新)に変更
  • selectedClassroom に触れないため、課題名入力フォームが保持される
  • メンバー詳細ペインのスクリーンショットカルーセルのインデックスも保持される

3. 不要な再レンダリング防止

  • refreshMembersOnly で JSON 比較により、データが変わっていない場合は state 更新をスキップ

Test plan

  • ?devlogin=xxx で先生ログイン → Google One Tap が出ない
  • 生徒モードで Google One Tap が出ない
  • クラス詳細表示中、課題名を編集中に30秒経過 → 入力内容が保持される
  • メンバー詳細のスクリーンショットカルーセルを2番目に切り替え → 30秒後もリセットされない

🤖 Generated with Claude Code

…weight refresh

Three fixes:

1. Skip attemptSilentReauth when mode is not 'teacher' or devlogin is
   used — prevents Google One Tap from appearing in student mode or
   when using dev bypass token

2. Auto-refresh (30s) now uses refreshMembersOnly instead of full
   loadClassroomDetail — only updates the members list without
   touching selectedClassroom, preserving:
   - Assignment name input field
   - Member detail pane (screenshot carousel index, comment input)
   - Any other UI state in the detail view

3. refreshMembersOnly uses JSON comparison to skip state updates
   when data hasn't changed, preventing unnecessary re-renders

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

🚀 Preview deployed: https://smalruby.jp/smalruby3-editor/fix/devlogin-relogin/

takaokouji and others added 2 commits April 11, 2026 19:58
When silent reauth fails, the expired idToken remained set, so the
30-second auto-refresh timer kept firing, causing repeated 401 →
attemptSilentReauth → One Tap display → cancel cycles.

Fix: set idToken to null when reauth fails. This stops the
auto-refresh useEffect (condition requires idToken to be truthy)
and prevents the One Tap loop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove console.log debug statements from handleTeacher401 and
  refreshMembersOnly
- Add ID_TOKEN_MAX_AGE_SECONDS support to Lambda: custom iat-based
  token age check for shorter session testing
- Pass ID_TOKEN_MAX_AGE_SECONDS env var through CDK stack conditionally

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@takaokouji takaokouji merged commit c3e06cc into develop Apr 11, 2026
15 checks passed
@takaokouji takaokouji deleted the fix/devlogin-relogin branch April 11, 2026 13:02
github-actions Bot pushed a commit that referenced this pull request Apr 11, 2026
…relogin

fix: prevent silent reauth in non-teacher/devlogin mode and use lightweight refresh
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