TDTech Digest

145. Google Drive OAuth 2.0 인증 설정 (Set up OAuth 2.0 authentication)

  • 원문: English
  • 위치: Additional capabilities › Knowledge Bases › Build a managed knowledge base › Create a managed knowledge base › Connect a data source › Google Drive › Set up OAuth 2.0 authentication

한 줄 요약

OAuth 클라이언트 ID/시크릿과 한 Google 사용자의 refresh token(OAuth 2.0 Playground로 발급)을 Secrets Manager에 저장합니다. 그 사용자가 볼 수 있는 콘텐츠만 크롤링하며 ACL은 지원하지 않습니다.

쉽게 말하면

“이 사람 계정으로 Drive를 읽어 가라"는 방식입니다. 대상 콘텐츠 전부에 접근 가능한 사용자로 로그인해 토큰을 받아야 합니다.

핵심 내용

설정 단계

단계할 일
1. API 활성화Google Drive API
2. OAuth 자격 증명OAuth consent screen(가능하면 Internal, 아니면 External) + https://www.googleapis.com/auth/drive.readonly scope. Web application 유형 OAuth client ID 생성, redirect URI에 https://developers.google.com/oauthplayground 추가
3. refresh tokenOAuth 2.0 Playground → 톱니바퀴에서 Use your own OAuth credentials → scope drive.readonly 입력 → Authorize → 대상 사용자로 로그인 → Exchange authorization code for tokens → Refresh token 복사
4. 시크릿 생성아래 JSON
{ "clientId": "<client-id>", "clientSecret": "<client-secret>", "refreshToken": "<refresh-token>" }
  • 크롤링 범위: 그 사용자의 내 드라이브, 공유받은 파일, 소속 공유 드라이브
  • ⚠️ refresh token이 철회되거나 만료되면 동기화가 인증 오류로 실패합니다. 사용자 본인, Workspace 관리자, 또는 장기간 미사용으로 철회될 수 있습니다. Playground 절차를 다시 해서 시크릿을 갱신하세요.
  • 다음: authType = OAUTH2로 데이터 소스 생성 → 146

SA 관점

  • 개인 사용자 계정에 묶이므로 퇴사·비밀번호 정책·토큰 철회에 취약합니다. PoC나 특정 폴더만 필요한 경우에 적합하고, 운영 환경은 서비스 계정(144)을 권합니다.