OAuth 클라이언트 ID 생성
Gemini Enterprise Authorization에 입력할 OAuth 2.0 자격증명 생성 절차
Gemini Enterprise가 사용자를 대신하여 토큰을 받고 에이전트 도구를 호출하려면 OAuth 2.0 클라이언트 ID가 필요합니다.
목차
1. 개요
OAuth 2.0 흐름에서 사용자는 Gemini Enterprise(클라이언트)에게 자기 권한으로 외부 API를 호출하는 것을 허용합니다.
[사용자 브라우저] → [Google OAuth 동의 화면] → [Gemini Enterprise]
|
사용자 동의
↓
Refresh Token 저장
↓
Tool 호출 시 Access Token 발급
2. Google Cloud Console에서 클라이언트 생성
- Google Cloud Console → [APIs & Services] → [Credentials]
- 상단 [+ Create Credentials] → [OAuth client ID]
- 입력
| 항목 | 값 |
|---|---|
| Application type | Web application |
| Name | Gemini Enterprise - {앱 이름} |
- [Create]
- 팝업에서 Client ID, Client Secret 복사 (Secret은 다시 볼 수 없음)
3. Authorized redirect URIs
다음 두 URI를 반드시 추가해야 Gemini Enterprise가 인증 콜백을 받을 수 있습니다.
https://vertexaisearch.cloud.google.com/oauth-redirect
https://vertexaisearch.cloud.google.com/static/oauth/oauth.html
도메인 이름이 변경되는 경우가 있으므로, 최신 공식 가이드에서 확인 후 추가하세요.
추가 도메인 사용 시
자체 임베드 위젯(예: 사내 포털)을 운영한다면, 해당 도메인의 콜백 URL을 추가합니다.
4. 동의 화면 구성
처음 OAuth 클라이언트를 만들 때 OAuth consent screen을 구성해야 합니다.
| 필드 | 값(예시) |
|---|---|
| User type | Internal (사내 사용 시) |
| App name | Gemini Enterprise (사내) |
| User support email | it-support@example.com |
| Authorized domains | example.com |
| Developer contact | gemini-admin@example.com |
| Scopes | openid, email, profile (도구 요구 시 추가) |
Scope 결정 가이드
- 단순 사용자 식별만 필요 →
openid email profile - Gmail 읽기 도구 →
https://www.googleapis.com/auth/gmail.readonly - Drive 읽기 도구 →
https://www.googleapis.com/auth/drive.readonly - BigQuery 사용자 권한 위임 →
https://www.googleapis.com/auth/bigquery
Scope를 추가할 때는 보안팀과 합의하고, 최소 권한 원칙을 지킵니다.
5. 회전 및 보관
| 항목 | 권장 |
|---|---|
| Client Secret 회전 주기 | 6~12개월 |
| 보관 위치 | Secret Manager |
| 노출 시 대응 | 즉시 폐기 후 재발급, Authorization 재등록 |
| 모니터링 | Cloud Audit Logs에서 oauth2.googleapis.com 호출 패턴 추적 |
# Secret Manager 보관 예시
echo -n "YOUR_CLIENT_SECRET" | \
gcloud secrets create gemini-oauth-client-secret \
--data-file=- \
--replication-policy=automatic
6. 트러블슈팅
| 증상 | 원인 후보 | 해결 |
|---|---|---|
redirect_uri_mismatch |
위 두 URI 누락 | 정확히 추가 후 잠시 대기 |
invalid_client |
Secret 오타 / 회전됨 | Authorization 재등록 |
access_denied |
사용자가 동의 거부 | 동의 화면 안내 보강 |
| 동의 화면이 외부 사용자에게도 보임 | User type이 External | Internal로 변경 |