Skip to content

feat: 데스크톱 앱 로그인 핸드오프 페이지 추가 (/auth/desktop)#385

Merged
sumi-0011 merged 1 commit into
mainfrom
feat/desktop-login-handoff
Apr 20, 2026
Merged

feat: 데스크톱 앱 로그인 핸드오프 페이지 추가 (/auth/desktop)#385
sumi-0011 merged 1 commit into
mainfrom
feat/desktop-login-handoff

Conversation

@sumi-0011
Copy link
Copy Markdown
Member

@sumi-0011 sumi-0011 commented Apr 20, 2026

Summary

  • /auth/desktop?redirect_uri=...&state=... 진입점 추가 — 데스크톱 앱이 GitHub OAuth를 웹에 위임하고 토큰을 로컬 콜백 서버로 전달받는 흐름
  • redirect_uri 화이트리스트 검증 (127.0.0.1:23338-23342/auth/callback 한정), 검증 실패 시 리디렉트 없이 에러 페이지 렌더 (open redirect 방지)
  • 인증된 세션 → 즉시 {redirect_uri}?token={accessToken}&state={state} 리디렉트, 미인증 → 기존 GitHub OAuth 흐름 위임 후 복귀

Changes

  • apps/web/src/constants/desktopAuth.ts — 화이트리스트 정규식 + 검증 함수 + 콜백 URL 빌더
  • apps/web/src/app/(noLocale)/auth/desktop/page.tsx — 서버 컴포넌트 진입점 (검증, 세션 확인, 리디렉트 분기)
  • apps/web/src/app/[locale]/auth/desktop/page.tsx — 클라이언트 컴포넌트 (미인증 시 login() 트리거)
  • apps/web/src/middleware.ts/auth/desktop publicPages 추가

Test plan

  • 미로그인 상태에서 /auth/desktop?redirect_uri=http://127.0.0.1:23338/auth/callback&state=abc123 접근 → OAuth → 콜백 URL에 ?token=...&state=abc123 확인
  • 로그인된 상태에서 동일 URL 접근 → OAuth 없이 즉시 콜백 리디렉트 확인
  • 잘못된 redirect_uri (localhost, 범위 외 포트, 다른 경로) → 에러 페이지, 리디렉트 없음 확인
  • state 누락 → 에러 페이지 확인

🤖 Generated with Claude Code

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능
    • 데스크톱 애플리케이션과의 인증 연동이 추가되었습니다. 사용자는 웹에서 인증을 완료한 후 데스크톱 애플리케이션으로 안전하게 이동할 수 있으며, 리다이렉트 URL은 검증되어 보안이 보장됩니다.

- /auth/desktop 진입 시 redirect_uri 화이트리스트 검증 (127.0.0.1:23338-23342)
- 인증됨 → 즉시 콜백 URL로 토큰 리디렉트, 미인증 → GitHub OAuth 흐름 위임
- state 파라미터 에코, open redirect 방지 처리 포함

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 271139b3-9f02-4a62-9c05-bc1709566a03

📥 Commits

Reviewing files that changed from the base of the PR and between eb69d85 and 8baca16.

📒 Files selected for processing (4)
  • apps/web/src/app/(noLocale)/auth/desktop/page.tsx
  • apps/web/src/app/[locale]/auth/desktop/page.tsx
  • apps/web/src/constants/desktopAuth.ts
  • apps/web/src/middleware.ts

📝 Walkthrough

Walkthrough

새로운 데스크톱 인증 플로우를 추가합니다. 서버 진입점에서 리디렉션 URI와 상태를 검증하고 세션을 확인하여 인증된 사용자를 데스크톱 앱으로 리디렉트하거나 클라이언트 인증 페이지로 안내합니다. 미들웨어에서 /auth/desktop을 퍼블릭 라우트 목록에 추가합니다.

Changes

Cohort / File(s) Summary
Desktop Authentication Pages
apps/web/src/app/(noLocale)/auth/desktop/page.tsx, apps/web/src/app/[locale]/auth/desktop/page.tsx
서버 진입점 페이지는 검증된 리디렉션 URI를 통해 세션을 확인하고 액세스 토큰 여부에 따라 분기합니다. 클라이언트 페이지는 인증 상태를 확인하여 인증된 사용자를 데스크톱 콜백으로, 미인증 사용자를 로그인으로 리디렉트합니다.
Desktop Auth Utilities
apps/web/src/constants/desktopAuth.ts
로컬호스트 리디렉션 URL을 제한하는 정규식 패턴, 유효성 검사 함수, 데스크톱 콜백 URL 생성 함수를 포함합니다.
Middleware Configuration
apps/web/src/middleware.ts
퍼블릭 페이지 목록에 /auth/desktop을 추가하여 인증 없이 접근 가능하도록 허용합니다.

Sequence Diagram

sequenceDiagram
    actor User
    participant Client as Desktop Client
    participant Server as Server<br/>(noLocale)
    participant Auth as Client Page<br/>[locale]
    participant Session as Session

    User->>Client: 인증 시작 (redirect_uri + state)
    Client->>Server: /auth/desktop?redirect_uri=...&state=...
    Server->>Server: redirect_uri & state 검증
    alt 검증 실패
        Server->>User: 오류 메시지 표시
    else 검증 성공
        Server->>Session: 세션 확인
        alt 액세스 토큰 있음
            Server->>Client: 데스크톱 콜백 URL로 리디렉트
            Client->>Client: 인증 완료
        else 액세스 토큰 없음
            Server->>Auth: /[locale]/auth/desktop?redirect_uri=...&state=...로 리디렉트
            Auth->>User: 로그인 프롬프트 표시
            User->>Auth: 로그인 수행
            Auth->>Session: 세션 생성
            Auth->>Client: 데스크톱 콜백 URL로 리디렉트
            Client->>Client: 인증 완료
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

area: Web

Poem

🐰 탁상용 앱으로 춤을 추며,
검증된 경로를 따라 재빠르게 뛰어가,
토큰을 들고 콜백으로 도약하네!
인증의 여정, 이제 부드럽게 흘러가고,
데스크톱 앱 친구들이 반겨주길 기다린다네. 🎉

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/desktop-login-handoff

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sumi-0011 sumi-0011 merged commit dee80ff into main Apr 20, 2026
3 checks passed
@sumi-0011 sumi-0011 deleted the feat/desktop-login-handoff branch April 20, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant