Skip to content

소셜 로그인 도메인 전략 정리 #29

Description

@dev-ant

배경

현재 구조에서 고민의 핵심은 **“아키텍처를 어디까지 깨끗하게 가져갈 것인가”**이다.
결론적으로, 소셜 로그인 관련 URL만 api.memonogi.com으로 고정하는 전략이 가장 안전하고 실무적인 선택으로 판단된다.

이 이슈에서는 그 이유와, 왜 다른 선택지들이 덜 적합한지 정리한다.


1. 왜 소셜 로그인은 api.memonogi.com이어야 하는가

소셜 로그인은 반드시 절대 도메인(Absolute Domain) 을 요구한다.

소셜 로그인에서 요구되는 요소

  • OAuth Provider (카카오, 구글 등)
  • Redirect URI
  • SameSite / Secure Cookie 정책
  • 도메인 단위 쿠키 스코프

👉 위 요소들은 nginx 내부 프록시나 라우팅으로 우회할 수 없는 영역이다.

즉, 아래 기능들은 반드시 공식적으로 고정된 단일 도메인을 가져야 한다.

  • 로그인
  • 로그아웃
  • 토큰 발급 / 갱신
  • 쿠키 설정 / 삭제

2. 권장 아키텍처 (정답 구조)

도메인 역할 분리

구분 도메인
소셜 로그인 / 인증 api.memonogi.com (고정)
일반 API 호출 www.memonogi.com/api/* (nginx 내부 프록시)
프론트엔드 www.memonogi.com

호출 흐름

① 로그인

Browser
https://api.memonogi.com/oauth/kakao

→ OAuth Provider
https://api.memonogi.com/oauth/callback

② 로그인 이후 일반 API 호출

fetch("/api/posts"); // 상대 경로

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions