sudo systemctl restart nginx
sudo systemctl restart drivepicker
You’ll need to create and configure a project in the Google Cloud Console to get both your Client ID (for OAuth) and API Key (for Drive API/Picker). Here’s a step-by-step:
- Go to Google Cloud Console.
- Sign in with your Google account.
- At the top left, click the project dropdown → New Project.
- Give it a name (e.g., Drive Picker Demo) → click Create.
-
In your project, go to APIs & Services > Library.
-
Enable the following:
- Google Drive API
- Google Picker API
-
In the left menu, go to APIs & Services > Credentials.
-
Click Create Credentials → OAuth client ID.
-
You may be asked to configure the OAuth consent screen:
- Choose External if not in Google Workspace.
- Fill in app name, user support email, etc.
- Add scopes:
https://www.googleapis.com/auth/drive.readonly. - Add your test users (your Google account at least).
- Save.
-
Back in Create OAuth client ID:
- Choose Web application.
- Give it a name (e.g., Drive Picker App).
- Under Authorized JavaScript origins, add your domain (e.g.,
http://localhost:5500while developing). - Under Authorized redirect URIs, you can leave blank (Picker doesn’t need it).
-
Click Create → copy the Client ID → this is your
GOOGLE_CLIENT_ID.
-
Still in Credentials, click Create Credentials → API key.
-
Copy the generated API key → this is your
GOOGLE_API_KEY. -
For security, click Restrict key:
- API restrictions: limit to Google Picker API and Google Drive API.
- Application restrictions: restrict by HTTP referrers (e.g.,
http://localhost:5500/*for development, your real domain in production).
✅ Now you can plug them into your .env file.
- Use API Key only in client-side apps if you’ve restricted it to your domain.
- Keep OAuth Client ID safe; it’s fine in frontend code but don’t share your Client Secret.