Based on the original work by Samy Nastuzzi, completely rewritten and optimized for Nextcloud 34 by el-choco.
Native Google Drive external storage support for Nextcloud. Fully refactored and optimized for Nextcloud 33 & 34.
- Nextcloud 34 Ready: Includes a custom
DirWrapperimplementation to seamlessly replace the deprecated and removedOC\Files\Stream\Dirclass. - Automated OAuth2 Flow: No more manual token copying! Generates and injects the token directly within the Nextcloud UI.
- Strict CSP & COOP Bypass: Fully compatible with modern browser security policies (like Microsoft Edge) and Nextcloud's strict Content Security Policy.
First of all, you need to enable the official files_external app in Nextcloud.
- Clone the repository into your custom apps folder:
git clone https://github.com/el-choco/files_external_gdrive_v2.git - Set the correct permissions (e.g.,
chown -R 33:33 files_external_gdrive_v2). - Enable the app via OCC:
php occ app:enable files_external_gdrive_v2
In order to use the app, you need to create an OAuth2 client via the Google Cloud Console.
Complete all needed information:
- App name: (e.g., "Nextcloud" so you remember what it is used for)
- Authorized JavaScript origins: Your Nextcloud domain.
- Authorized redirect URIs: Important! Must exactly match your Nextcloud callback URL (e.g.,
https://your-domain.com/apps/files_external_gdrive_v2/callback).
- Go to Admin Settings -> External Storage.
- Select Google Drive from the dropdown menu.
- Enter your Google Client ID and Client Secret.
- Click the new "🔑 Connect with Google & Get Token" button.
- Authorize the app in the Google popup window.
- Once the popup closes automatically and the button turns green ("✅ Success! Please click Create!"), click the checkmark to save and mount your drive.