Task Session is a powerful self-hosted project management system that allows seamless integration with Google Drive for enhanced file management capabilities. This comprehensive guide will walk you through the entire process of connecting Google Drive API with your Task Session installation.
Prerequisites
Before starting the integration process, ensure you have:
- Task Session installed and running
- Admin access to your Task Session installation
- Google account with access to Google Cloud Console
- Domain with SSL certificate (HTTPS required for OAuth)
Step 1: Create Google Cloud Project
1. Visit Google Cloud Console
- Go to Google Cloud Console
- Sign in with your Google account
2. Create New Project
- Click on the project dropdown at the top
- Select “New Project”
- Enter project name:
Task Session Integration - Choose your organization (if applicable)
- Click “Create”
3. Select Your Project
- Make sure your newly created project is selected
- You’ll see the project name in the top navigation bar
Step 2: Enable Google Drive API
1. Navigate to API Library
- In the Google Cloud Console, go to “APIs & Services” ? “Library”
- Search for “Google Drive API”
2. Enable the API
- Click on “Google Drive API” from the search results
- Click the “Enable” button
- Wait for the API to be enabled (usually takes a few seconds)
3. Verify API Status
- You should see “Google Drive API” listed in your enabled APIs
- The status should show as “Enabled”
Step 3: Create OAuth 2.0 Credentials
1. Go to Credentials
- Navigate to “APIs & Services” > “Credentials”
- Click “Create Credentials” > “OAuth 2.0 Client IDs”
2. Configure OAuth Consent Screen (if not already done)
- Choose “External” user type
- Fill in the required information:
- App name: Task Session Integration
- User support email: Your email
- Developer contact: Your email
- Click “Save and Continue”
- Skip the Scopes section for now
- Add test users if needed
- Review and submit
3. Create OAuth 2.0 Client ID
- Application type: Web application
- Name: Task Session Google Drive Integration
- Authorized redirect URIs:
https://yourdomain.com/admin/google-drive-integration.php?? Important: Replaceyourdomain.comwith your actual Task Session domain
4. Get Your Credentials
- Click “Create”
- Copy the Client ID and Client Secret
- Keep these credentials secure – you’ll need them for Task Session configuration
Step 4: Configure Task Session
1. Access Google Drive Integration
- Log in to your Task Session admin panel
- Navigate to System Settings > Google Drive Integration
- Or directly visit:
https://yourdomain.com/admin/google-drive-integration.php
2. Enable Google Drive API
- Check the “Enable Google Drive API to upload files” checkbox
- This activates the integration features
3. Enter API Credentials
- Client ID: Paste your Google OAuth 2.0 Client ID
- Client Secret: Paste your Google OAuth 2.0 Client Secret
- Click “Save Settings”
4. Verify Configuration
- You should see a success message confirming the settings were saved
- The authorization section will now be available
Step 5: Authorize Google Drive Access
1. Authorize Access
- After saving your credentials, click “Authorize Google Drive”
- You’ll be redirected to Google’s authorization page
2. Grant Permissions
- Sign in with the Google account you want to use
- Review the permissions requested by Task Session
- Click “Allow” to grant access
3. Complete Authorization
- You’ll be redirected back to Task Session
- You should see “Google Drive authorization successful!” message
- The status should now show as “Authorized”
Features & Benefits
Once successfully integrated, Task Session’s Google Drive integration provides:
Automatic File Management
- Seamless Upload: Files uploaded to Task Session are automatically stored in Google Drive
- Organized Storage: Files are organized in project-specific folders
- Version Control: Track file versions and changes
Advanced File Operations
- Folder Creation: Automatically create project folders in Google Drive
- File Sharing: Generate shareable Google Drive links for team collaboration
- Direct Downloads: Download files directly from Google Drive
- File Preview: Preview files without downloading
Enhanced Collaboration
- Team Access: Share files with team members via Google Drive
- Client Sharing: Share project files with clients securely
- Real-time Sync: Keep files synchronized between Task Session and Google Drive
Storage Benefits
- Unlimited Storage: Leverage Google Drive’s storage capacity
- Backup Solution: Automatic backup of all project files
- Cost Effective: Reduce local storage requirements
Troubleshooting
Common Issues and Solutions
“Invalid redirect URI” Error
Problem: Google shows redirect URI mismatch error
Solution:
- Ensure your redirect URI in Google Console exactly matches:
https://yourdomain.com/admin/google-drive-integration.php - Check that your domain uses HTTPS (required for OAuth)
“Authorization Failed” Error
Problem: Authorization process fails
Solution:
- Verify your Client ID and Client Secret are correct
- Ensure Google Drive API is enabled in your project
- Check that OAuth consent screen is properly configured
“Token Refresh Failed” Error
Problem: Access tokens expire and can’t be refreshed
Solution:
- Click “Refresh Tokens” button in Task Session
- Re-authorize if refresh fails
- Check your internet connection
Files Not Uploading to Google Drive
Problem: Files upload to Task Session but not to Google Drive
Solution:
- Verify authorization status shows “Authorized”
- Check Google Drive API quotas and limits
- Ensure sufficient Google Drive storage space
Debug Mode
Enable debug mode to troubleshoot issues:
- Add
?debug_license=1to any Task Session URL - Check the debug information displayed
- Look for specific error messages
Security Best Practices
Credential Security
- Never share your Client ID and Client Secret
- Store credentials securely (consider using environment variables)
- Regular rotation of OAuth credentials (every 90 days recommended)
Access Control
- Limit OAuth scope to only required permissions
- Use specific Google accounts for integration (not personal accounts)
- Monitor access logs regularly
Data Protection
- Enable 2FA on your Google account
- Use strong passwords for all accounts
- Regular backups of your Task Session database
Advanced Configuration
Custom OAuth Scopes
If you need additional permissions, you can modify the OAuth scopes in your Google Cloud Console:
https://www.googleapis.com/auth/drive.file(default)https://www.googleapis.com/auth/drive(full access)https://www.googleapis.com/auth/drive.metadata(metadata only)
Multiple Google Accounts
To use multiple Google accounts:
- Create separate OAuth credentials for each account
- Configure each set of credentials in Task Session
- Switch between accounts as needed
Step 6: Setup Cron Job for Token Refresh
After successfully authorizing Google Drive access, it’s essential to set up a cron job to automatically refresh your access tokens. This ensures smooth, uninterrupted operation of your Google Drive integration without manual intervention.
Why Cron Setup is Important
- Automatic Token Refresh: Google OAuth tokens expire periodically. A cron job automatically refreshes them before expiration
- Uninterrupted Service: Prevents service interruptions due to expired tokens
- Seamless Operation: Your Google Drive integration will continue working smoothly without manual token refresh
- Centralized Management: Task Session uses a central cron system that manages all automated tasks, including Google Drive token refresh
1. Access Your Cron Management
- Log in to your Task Session admin panel
- Navigate to System Settings ? Cron Management
- Or directly visit:
https://yourdomain.com/admin/cron.php
2. Locate Google Drive Token Refresh
- In the Cron Management panel, find the “Google Drive” tab
- You’ll see the “Google Drive Token Refresh” cron job
- Ensure it’s enabled (toggle switch should be ON)
3. Configure Cron Job on Your Server
For Linux/Unix Servers (cPanel, Plesk, etc.)
Add the following cron job to your server’s crontab:
/5 * * * * /usr/local/bin/php /yourpath/cron.php > /dev/null 2>&1
Important Notes:
- Replace
/usr/local/bin/phpwith your server’s PHP CLI path (you can find this by runningwhich phpin SSH) - Replace
/path/to/your/tasksessionwith your actual Task Session installation path - The
*/5means the cron runs every 5 minutes (recommended frequency) - You can adjust the frequency based on your needs (e.g.,
*/10for every 10 minutes)
For Windows Servers (Task Scheduler)
- Open Task Scheduler on your Windows server
- Create a new Basic Task
- Set the trigger to run Daily or at your preferred interval
- Set the action to Start a program
- Program/script:
C:\path\to\php.exe(your PHP executable path) - Add arguments:
D:\path\to\your\tasksession\cron.php - Save the task
4. Verify Cron Job is Working
- In the Cron Management panel, click “Run All Cron Jobs” to test
- Check the “Last Run” timestamp for Google Drive Token Refresh
- Verify the status shows as “Active” (green indicator)
- Monitor the cron logs to ensure it’s executing successfully
5. Central Cron Path
Your central cron file is located at:
https://yourdomain.com/cron.php
6. Testing Your Cron Setup
- Wait for the cron job to run (or manually trigger it from Cron Management)
- Check the Google Drive integration status – it should remain “Authorized”
- Verify that file uploads to Google Drive continue working without issues
- Review the cron execution logs in the Cron Management panel
Important Reminders
Keep enabled the Google Drive Token Refresh cron job in the Cron Management panel
Don’t skip this step! Without a cron job, your Google Drive tokens will expire and require manual refresh
Test immediately after setting up the cron to ensure it’s working correctly
Monitor regularly to ensure the cron job continues running (check server logs if issues arise)
Conclusion
Integrating Google Drive with Task Session significantly enhances your project management capabilities by providing:
- Unlimited cloud storage for all project files
- Seamless file sharing and collaboration
- Automatic backup and version control
- Enhanced security and access control
The integration process is straightforward and takes only a few minutes to complete. Once set up, your team will benefit from improved file management and collaboration capabilities.
Next Steps
After successful integration:
- Test file uploads to ensure everything works correctly
- Train your team on the new Google Drive features
- Set up project folders for better organization
- Configure sharing permissions as needed

