Perfect!
Let's start with Google Drive and API setup
This is essential for storing face images (both authorized and unknown) and accessing them in real-
time from your Python server.
Step-by-Step: Google Drive and API Setup
Step 1: Create Google Drive Folders
You’ll need two folders in your Google Drive:
Folder Name Purpose
Authorized_Faces For storing known face images.
Unknown_Faces For temporarily storing unrecognized faces from ESP32.
How to create:
1. Open Google Drive.
2. Click “+ New” → Folder → Name it Authorized_Faces.
3. Do the same to create Unknown_Faces.
Get their Folder IDs:
1. Open the folder.
2. Check the URL:
3. https://drive.google.com/drive/folders/1abcDxyzAbCDeFghIJklMNopQRsTuvWx
4. Copy the part after folders/
Example:
5. Folder ID = 1abcDxyzAbCDeFghIJklMNopQRsTuvWx
Save both Folder IDs somewhere — you'll need them in your Python script.
Step 2: Enable Google Drive API
1. Go to Google Cloud Console.
2. Click on “Select a project” → New Project.
3. Name your project (e.g., “Smart Door Project”) → Click Create.
Enable Google Drive API:
4. In the left menu, go to “APIs & Services” → “Library”.
5. Search for Google Drive API → Click it → Click Enable.
Step 3: Create OAuth 2.0 Credentials
1. In Cloud Console, go to “APIs & Services” → “Credentials”.
2. Click “+ Create Credentials” → OAuth client ID.
3. For first-time setup, click “Configure consent screen”:
o Choose External
o Fill in App name and support email
o Save and Continue until done
4. Go back to Create Credentials → OAuth client ID.
o Application Type: Desktop App
o Name: SmartDoorClient
o Click Create
5. Download the credentials file:
o You'll see the option to Download JSON.
o Save it as:
o credentials.json
o This file will go in the same folder as your Python code (server.py).
Step 4: Install Python Packages
In your Python environment (e.g., using terminal or Anaconda):
pip install google-auth google-auth-oauthlib google-auth-httplib2 google-api-python-client
This lets your Python code interact with Google Drive using the credentials.