🚀 Drive-as-a-Service

Pluggable Google Drive folder management with access control

Service Online

🔑 Get Started

Sign in with Google to get your unique API key and start using the service.

🔗 Sign in with Google 📦 Download Widget
🔐

Secure Authentication

OAuth2 integration with Google accounts. Each user gets a unique API key for secure access.

📁

Folder Management

Browse, select, and manage Google Drive folders with advanced permission controls.

👥

Access Control

Grant time-limited access to specific users with automatic expiration management.

🔒

Download Prevention

Apply official Google Drive restrictions to prevent downloading while allowing viewing.

🔌

Easy Integration

Reusable JavaScript widget with customizable themes for quick integration.

Auto Expiration

Automated cron job manages membership expiration and access revocation.

📚 API Documentation

🔑 Authentication Endpoints

GET/auth/google

Description: Start Google OAuth2 flow

Response: Redirects to Google OAuth consent screen

GET/auth/callback

Description: OAuth2 callback endpoint

Query Parameters:

Parameter Type Required Description
code string Required Authorization code from Google

GET/api/user/profile

Description: Get authenticated user's profile

Headers:

X-API-Key: your-api-key-here

Response:

{ "success": true, "user": { "id": 1, "google_id": "123456789", "email": "user@example.com", "name": "John Doe", "profile_picture": "https://...", "created_at": "2024-01-01T00:00:00.000Z" } }

📁 Drive Operations

GET/api/drive/folders

Description: List Google Drive folders

Headers:

X-API-Key: your-api-key-here

Query Parameters:

Parameter Type Required Description
parentId string Optional Parent folder ID (default: 'root')

Response:

{ "success": true, "folders": [ { "id": "1ABC123XYZ", "name": "My Course Folder", "parents": ["0B1234567890"] } ], "parentInfo": { "id": "root", "name": "My Drive" }, "currentPath": "root" }

POST/api/drive/prevent-download

Description: Apply download restrictions to folder and all contents

Headers:

X-API-Key: your-api-key-here Content-Type: application/json

Request Body:

Parameter Type Required Description
folderId string Required Google Drive folder ID

Example Request:

{ "folderId": "1ABC123XYZ456" }

Response:

{ "success": true, "message": "Download prevention applied successfully" }

👥 Membership Management

POST/api/membership/register

Description: Register a new membership with folder access

Headers:

X-API-Key: your-api-key-here Content-Type: application/json

Request Body:

Parameter Type Required Description
folderId string Required Google Drive folder ID
memberEmail string Required Member's email address
endDate string Optional Access expiry date (ISO string) or "-1" for lifetime

Example Request:

{ "folderId": "1ABC123XYZ456", "memberEmail": "student@example.com", "endDate": "2024-12-31T23:59:59.999Z" }

Response:

{ "success": true, "message": "Membership registered and access granted", "membershipId": 42 }

POST/api/membership/revoke

Description: Revoke member access to folder

Request Body:

Parameter Type Required Description
folderId string Required Google Drive folder ID
memberEmail string Required Member's email address

POST/api/membership/update-end-date

Description: Update membership expiration date

Request Body:

Parameter Type Required Description
folderId string Required Google Drive folder ID
memberEmail string Required Member's email address
endDate string Required New expiry date (ISO string) or "-1" for lifetime

GET/api/membership/list

Description: List all memberships for authenticated user

Response:

{ "success": true, "memberships": [ { "id": 1, "folder_id": "1ABC123XYZ", "member_email": "student@example.com", "end_date": "2024-12-31T23:59:59.999Z", "is_expired": false, "created_at": "2024-01-01T00:00:00.000Z" } ] }

🔌 Widget Integration

The JavaScript widget provides an easy way to integrate Drive-as-a-Service into your applications.

🚀 Quick Start

<!-- Include the widget --> <script src="http://localhost:3000/widget.js"></script> <script> // Initialize widget const driveWidget = new DriveServiceWidget({ baseURL: 'http://localhost:3000', apiKey: 'your-api-key-here', theme: 'light', // or 'dark' onAuth: (user) => console.log('Authenticated:', user), onError: (error) => console.error('Error:', error), onFolderSelect: (folder) => console.log('Selected:', folder) }); // Create authentication button driveWidget.createAuthButton('auth-container'); // Create folder picker driveWidget.createFolderPicker('picker-container'); </script>

🎨 Customization Options

// Custom button styling driveWidget.createAuthButton('container', { text: '🔗 Connect Drive', backgroundColor: '#4285f4', color: 'white', padding: '12px 24px', borderRadius: '8px', fontSize: '16px', fontFamily: 'Arial, sans-serif' }); // Folder picker with target input driveWidget.createFolderPicker('picker', { targetInput: 'folderIdInput' });

📋 Available Methods

Method Description Parameters
authenticate() Start OAuth flow None
listFolders(parentId) List Drive folders parentId (string, optional)
registerMembership(folderId, email, endDate) Register membership folderId, email, endDate
revokeMembership(folderId, email) Revoke access folderId, email
preventDownload(folderId) Apply download restrictions folderId
🏫

Demo School App

See the service in action with our demo school application.

View Demo
👨‍💼

Admin Dashboard

Manage courses, folders, and student access permissions.

Admin Panel