Langkah 1: Buat Service Account di Google Cloud
- Buka Google Cloud Console & buat project baru.
- Aktifkan Google Drive API di menu APIs & Services > Enable APIs.
- Buka Credentials > Create Credentials > Service Account.
- Klik Service Account yang dibuat > Tab Keys > Add Key > Create new key (JSON). File JSON akan terunduh.
Langkah 2: Share Folder Google Drive
- Buka folder target di Google Drive Anda.
- Klik Share, lalu tambahkan email Service Account (contoh:
[email protected]) sebagai Editor.
- Salin ID folder dari URL browser:
drive.google.com/drive/folders/ID_FOLDER_DI_SINI.
Langkah 3: Konfigurasi di Web App
Buka file .env di folder project ini, lalu isi:
GOOGLE_DRIVE_ROOT_FOLDER_ID=1a2b3c4d...
[email protected]
GOOGLE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n..."
Atau letakkan file JSON yang diunduh dengan nama service-account.json di root folder project.