공개 문서
docs/gws-auth-and-verified-usage.md
아래는 docs/gws-auth-and-verified-usage.md 와 동일한 원문입니다. Markdown과 HTML 변환 결과를 각각 복사할 수 있습니다.
공개 문서 원문 (Markdown)
# Google Workspace CLI (gws) 인증 및 검증된 사용법
> 실제 인증·테스트로 확인된 절차만 정리. (미검증/실패 기능은 제외)
---
## 1. 설치 (macOS)
```bash
npm install -g @googleworkspace/cli
gws --version
```
OAuth 설정에 **gws auth setup**을 쓸 경우에만 gcloud 설치:
```bash
brew install --cask google-cloud-sdk
```
---
## 2. OAuth 설정 (택 1)
**A. 프로젝트 .env 사용 (이 프로젝트)**
`projects/skoolchef-tutorial/.env`에 이미 넣었다면:
```bash
cd projects/skoolchef-tutorial
set -a && source .env && set +a
gws auth login
```
**B. gcloud 사용**
gcloud 설치 후:
```bash
gws auth setup
gws auth login
```
**C. 수동**
[OAuth 클라이언트 생성](https://console.cloud.google.com/apis/credentials) → 데스크톱 앱 → JSON 다운로드 → `~/.config/gws/client_secret.json`에 저장 후 `gws auth login`.
---
## 3. 참고 링크
| 용도 | URL |
|------|-----|
| OAuth 클라이언트 | [console.cloud.google.com/apis/credentials](https://console.cloud.google.com/apis/credentials) |
| OAuth 동의 화면 | [credentials/consent](https://console.cloud.google.com/apis/credentials/consent) |
| GCP 프로젝트 생성 | [projectcreate](https://console.cloud.google.com/projectcreate) |
---
## 4. 검증된 명령 (정상 동작 확인됨)
| 기능 | 명령 |
|------|------|
| Drive 파일 목록 | `gws drive files list --params '{"pageSize":10}'` |
| Drive 파일 메타 | `gws drive files get --params '{"fileId":"FILE_ID"}'` |
| Docs 문서 본문(JSON) | `gws docs documents get --params '{"documentId":"DOC_ID"}'` |
| 인증 확인 | `gws auth login` (브라우저 로그인 후 완료) |
**주의:** `gws drive files download`는 현재 500 오류 발생 — 파일 받기는 브라우저 또는 rclone 사용 권장.
---
상세 설치·옵션은 챕터 [Google Workspace CLI 설치 및 시작](../content/courses/13-google-workspace-cli-install.mdx) 참고.
공개 문서 변환 코드 (HTML)
<h1>Google Workspace CLI (gws) 인증 및 검증된 사용법</h1>
<blockquote>
<p>실제 인증·테스트로 확인된 절차만 정리. (미검증/실패 기능은 제외)</p>
</blockquote>
<hr>
<h2>1. 설치 (macOS)</h2>
<pre><code class="language-bash">npm install -g @googleworkspace/cli
gws --version
</code></pre>
<p>OAuth 설정에 <strong>gws auth setup</strong>을 쓸 경우에만 gcloud 설치:</p>
<pre><code class="language-bash">brew install --cask google-cloud-sdk
</code></pre>
<hr>
<h2>2. OAuth 설정 (택 1)</h2>
<p><strong>A. 프로젝트 .env 사용 (이 프로젝트)</strong><br><code>projects/skoolchef-tutorial/.env</code>에 이미 넣었다면:</p>
<pre><code class="language-bash">cd projects/skoolchef-tutorial
set -a && source .env && set +a
gws auth login
</code></pre>
<p><strong>B. gcloud 사용</strong><br>gcloud 설치 후:</p>
<pre><code class="language-bash">gws auth setup
gws auth login
</code></pre>
<p><strong>C. 수동</strong><br><a href="https://console.cloud.google.com/apis/credentials">OAuth 클라이언트 생성</a> → 데스크톱 앱 → JSON 다운로드 → <code>~/.config/gws/client_secret.json</code>에 저장 후 <code>gws auth login</code>.</p>
<hr>
<h2>3. 참고 링크</h2>
<table>
<thead>
<tr>
<th>용도</th>
<th>URL</th>
</tr>
</thead>
<tbody><tr>
<td>OAuth 클라이언트</td>
<td><a href="https://console.cloud.google.com/apis/credentials">console.cloud.google.com/apis/credentials</a></td>
</tr>
<tr>
<td>OAuth 동의 화면</td>
<td><a href="https://console.cloud.google.com/apis/credentials/consent">credentials/consent</a></td>
</tr>
<tr>
<td>GCP 프로젝트 생성</td>
<td><a href="https://console.cloud.google.com/projectcreate">projectcreate</a></td>
</tr>
</tbody></table>
<hr>
<h2>4. 검증된 명령 (정상 동작 확인됨)</h2>
<table>
<thead>
<tr>
<th>기능</th>
<th>명령</th>
</tr>
</thead>
<tbody><tr>
<td>Drive 파일 목록</td>
<td><code>gws drive files list --params '{"pageSize":10}'</code></td>
</tr>
<tr>
<td>Drive 파일 메타</td>
<td><code>gws drive files get --params '{"fileId":"FILE_ID"}'</code></td>
</tr>
<tr>
<td>Docs 문서 본문(JSON)</td>
<td><code>gws docs documents get --params '{"documentId":"DOC_ID"}'</code></td>
</tr>
<tr>
<td>인증 확인</td>
<td><code>gws auth login</code> (브라우저 로그인 후 완료)</td>
</tr>
</tbody></table>
<p><strong>주의:</strong> <code>gws drive files download</code>는 현재 500 오류 발생 — 파일 받기는 브라우저 또는 rclone 사용 권장.</p>
<hr>
<p>상세 설치·옵션은 챕터 <a href="../content/courses/13-google-workspace-cli-install.mdx">Google Workspace CLI 설치 및 시작</a> 참고.</p>