WP File Download Addon: Google Drive Integration
1. Create a Google Drive App
The Google Drive integration is distributed as a separate Add-on. You need to install this add-on (plugin) additionally to WP File Download. The addon includes integration for Dropbox and OneDrive too.
First, you need a Google dev App to connect your website to Google Drive. Go to https://console.developers.google.com/project and create a new project.
Then set up a project name (no accent)
Then wait a few seconds for the project creation…
If it's the first time you're using the Google Drive API, you should go to Navigation menu > APIs and Services > Library to activate it.
From the left menu, click on “Navigation menu > APIs and Services”
Then on the left menu “Credentials” >> “New credentials” >> OAuth client ID (if asked, add a name to your OAuth consent screen).
Now, the most important step.
- Select “Web application” and add a name of your choice.
- Authorized redirect URIs: https://your-domain.com/wp-admin/admin.php?page=wpfdAddon-cloud&task=googledrive.authenticate (replace by your domain name)
Then… voilà! You got your ID and Secret to add in the WP File Download configuration
In order to use "the sync with Google Drive in real time" feature, you need to verify your Domain. You should follow these steps below:
Please go to “APIs & Services” >> "Domain verification", click on Add domain button. Next, input your domain and click on Add domain button.
If your domain was verified, then you add domain successfully. Go to WP File download configuration for the next step.
If your domain has not been verified, a pop-up window will be appeared, click on Take me there button.
You will be linked to "Webmaster Central" page. From here, you should:
- Select your domain name provider, if the list does not include your provider, choose Other
- Add the TXT record to the DNS configuration. E.g: google-site-verification=vyV1rZfPloPdrFjau0Hw2W9d18_bd...
- Click on Verify button
The page with successful notification will be shown if you do correctly the steps above. After that, go to the WP File download configuration for the next step.
2. Login to Google Drive in WP File Download
Then go back in WordPress admin and click on the menu WP File Download > Configuration > Cloud Connection tab > Google Drive settings section. Paste your
- Client ID
- Client secret
Then save the configuration and click on the Connect Google Drive button to login your Google account.
After that, a pop-up window will be shown and you can select your account.
If you haven’t made any mistake you should validate the authorization in a new window like bellow
The connection should be a success ☺ Simultaneously, you will see the option "Watch changes from Google Drive" is turned on. If you turn off Files and Folders will not be synchronized immediately from Google Drive to your WP File Download.
Then you can create Google Drive folders and upload files in it!
3. How it works? What can I do with GG Drive?
How does it work?
WP File download will generate a root folder on your Google Drive with the site name
All the categories and subcategories added in WP File Download will be added under this folder.
What are the sync directions?
It works in both directions! You can add a file from Google Drive and see it in WP File Download or add a file in WP File Download and see it in Google Drive. It also means you can manage WordPress files from your desktop using Google Drive sync software. That’s crazy! Yes we know ☺
Also if you erase a file from Google Drive you have to empty trash to erase it from Google Drive.
Google has recently introduced a new security layer that forces apps to be verified. If you've created the app with your Google account and then you log in from WordPress with the very same account you won't see this error.
This error will only appear if you've created an App with a Google account and trying to connect to Google from WordPress with another account.
In this case, you need your app to get approved by Google following this process: https://support.google.com/code/contact/oauth_app_verification