Skip to main content

WP File Download Addon: Google Drive Integration

1. Login to Google Drive in WP File Download

Automatic mode

From now, you can save a lot of time while connecting to the Google Drive server.  First, in order to use this feature, you have to link your Joomunited account at Menu Settings > General, please click on the WordPress settings link if you have not connected.

 

unconnected-google-drive

 

Then go back to the settings and just click on Connect Google Drive button on the right corner.

 

automatic-google-drive

 

Then follow the next steps to finish the connection.

 

auto-google-drive-connected

 

Manual mode

With the credentials in the previous step, please go to 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 to your Google account.

 

google-drive-connect

 

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

 

confirm-autho

 

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.

 

watch-change-google-fd

 

Then you can create Google Drive folders and upload files in it!

 

create-googledrive-cat

 

2. 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.

 

WordPress file manager: Synchronization to Google Drive

 

All the folders and sub-folders added in WP File Download will be synchronized under this folder (WP File Download - {sitename}). And vice versa, all your files and categories from that root folder on Google Drive will be synchronized to your WP File Download dashboard on Wordpress.

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 Drive files sent to WordPress

 

Get rid of the error: error: "invalid_scope when connecting WP File Download with 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

 

 

 

3. 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.cloud.google.com/ and navigate to the top-left, click Menu menu > IAM & Admin > Create a Project.

 

Create-project-1

 

Then set up a project name (no accent)

 

project-name

 

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.

 

enable-api

 

From the left menu, click on “Navigation menu > APIs & Services”

 

credentials-menu-1

 

Then on the left menu “Credentials”, on the main panel click “ + New Credentials” >> OAuth client ID (if asked, add a name to your OAuth consent screen).

 

create-Credentials-1

 

Now, the most important step.

  • Select “Web application” and add a name of your choice.
  • Authorized JavaScript origin: https://your-domain.com (replace by your domain name, no slash, no www.)
  • Authorized redirect URIs: https://your-domain.com/wp-admin/admin.php?page=wpfdAddon-cloud&task=googledrive.authenticate (replace by your domain name)

 

create-web-application

 

Note: if this warning appears: "To create an OAuth client ID, you must first set a product name on the consent screen" you should click on Configure consent screen button or go to APIs & Services >> OAuth consent screen, then add your domain name at Authorized domains.

Then you need to select User Type, Internal is often for accounts in an organization or team and External is for personal accounts.

 

OAuth-user-type

 

  • Internal: your app is limited to Google Workspace (known as G Suite) users within your organization. You will not need to submit your app for verification.
  • External: your app will available to any user with a Google account but your app should be public and verified.

Then, fill in your authorized domains and continue with the following steps to finish the app registration. Now you can back to the previous step Select “Web application” to create the credentials.

 

consent-screen

 

And the publishing status should be Production, if it's currently Testing, you should click on Publish app button to change the status.

 

publish-app

 

Then… voilà! You have your ID and Secret to add to the WP File Download configuration.

 

oauth-client