Overview
StreamVault integrates directly with Google Drive to index and stream your media collection without downloading files. The integration uses OAuth2 for secure authentication and the Changes API for efficient real-time synchronization.Authentication Flow
StreamVault uses a secure backend proxy for OAuth2 authentication to keep client credentials safe.OAuth2 Setup
Initiate Authentication
Click “Connect Google Drive” in Settings. StreamVault opens the authorization URL via the backend server:The backend handles the OAuth flow and returns tokens via a local callback server.
Callback Server
A temporary TCP listener on port 8085 receives the authorization callback:Tokens are Base64-encoded in the callback URL and decoded locally.
Full Drive Indexing
StreamVault can scan your entire Google Drive for video files with a single click.One-Click Scan
The “Update Library” button triggers a recursive scan starting from Drive root:Supported Video Formats
- MP4 (
video/mp4) - MKV (
video/x-matroska) - AVI (
video/avi) - MOV (
video/quicktime) - WebM (
video/webm) - M4V (
video/x-m4v) - WMV (
video/x-ms-wmv) - FLV (
video/x-flv) - TS (
video/mp2t)
The scan automatically handles pagination with 100 files per page and recursively scans subfolders when enabled.
Real-Time Change Detection
StreamVault uses Google Drive’s Changes API to detect new files without rescanning the entire drive.Changes API Implementation
Initialize Token
On first scan, get a start page token:This token is stored in the database for subsequent polls.
Polling Frequency
Changes are checked every 5 seconds when the app is running (including when minimized to system tray).The Changes API is highly efficient - it only returns items that have changed since the last poll, not the entire file list.
Background Sync
StreamVault continues monitoring your Drive even when minimized to the system tray.System Tray Notifications
When new media is detected, Windows notifications are displayed:Incremental Updates
Only new files are indexed:File Deletion Support
StreamVault detects when files are removed from Drive:Streaming URLs
Files are streamed directly from Google Drive without downloading:Account Information
View your connected Google account details:Error Handling
Robust error handling with automatic retries:- Token Expiration: Automatic refresh via backend
- Network Errors: Connection timeout after 15s
- Rate Limiting: Respects
Retry-Afterheaders - API Errors: Graceful degradation with user-friendly messages
Privacy & Security
Your Google credentials are never stored locally. StreamVault uses OAuth2 tokens which can be revoked at any time from your Google Account settings.
Data Storage
Locally stored data:- Tokens:
%APPDATA%/StreamVault/gdrive_tokens.json(encrypted by OS) - Database: File metadata only (no video content)
- Image Cache: Posters/thumbnails from TMDB
Permissions Required
https://www.googleapis.com/auth/drive.readonly- Read-only access to Drive fileshttps://www.googleapis.com/auth/userinfo.email- Display your email in settings
Troubleshooting
”Failed to connect to Google Drive”
- Check your internet connection
- Verify the backend server is accessible
- Try disconnecting and reconnecting in Settings
”No videos found during scan”
- Ensure video files are in supported formats
- Check that files aren’t in the trash
- Verify OAuth permissions weren’t revoked
”Changes not detected”
- Wait up to 5 seconds for the next poll
- Manually click “Update Library” to force a scan
- Check that the app is running (even if minimized)