Skip to content

feat: 認証を localStorage から httponly Cookie に変更#40

Merged
topi-log merged 1 commit into
mainfrom
feat/#18_cookie_auth
Apr 25, 2026
Merged

feat: 認証を localStorage から httponly Cookie に変更#40
topi-log merged 1 commit into
mainfrom
feat/#18_cookie_auth

Conversation

@topi-log

Copy link
Copy Markdown
Owner

Summary

バックエンド

  • CORS: credentials: true を追加(Cookie のクロスオリジン送信を許可)
  • OmniauthCallbacksController: OAuth 成功後に uid / access-token / client / expiry を httponly Cookie にセットし、URLパラメータなしで /record にリダイレクト
  • ApplicationController: ActionController::Cookies を include し、set_auth_headers_from_cookies で Cookie の値を認証ヘッダーに注入(既存の SetUserByToken をそのまま利用)
  • SessionsController: ログアウト時に認証 Cookie を削除

フロントエンド

  • authFetch / baseFetch: credentials: "include" を追加、getAuthHeaders() と localStorage 操作を全て削除
  • useAuth: currentUser()(URLパラメータ受け取り)を削除、autoLogin() / logout() をシンプル化
  • record/page.tsx: URLパラメータ(uid/client/token/expiry)の読み取りを削除、常に autoLogin() で認証確認

Test plan

  • フロントエンド yarn test 2件パス
  • フロントエンド yarn build 成功
  • バックエンド bundle exec rspec 29件パス

Closes #18

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Apr 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
leaf-record Ready Ready Preview, Comment Apr 25, 2026 4:55am

@topi-log topi-log merged commit ab2e5fb into main Apr 25, 2026
6 checks passed
@topi-log topi-log deleted the feat/#18_cookie_auth branch April 25, 2026 05:00
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.

fix: 認証をローカルストレージではなくCookieに変更

1 participant