Configuring Google Drive API access in UpdraftPlus

Note: Google are constantly moving around parts of their “Cloud Console”- some of the screenshots and steps may differ from those shown below if they change it again. So, please make some allowances and don’t get too confused! The screenshots below are from their current cloud console (as at Dec 2016); for screenshots/steps from a previous version (which may, or may not, be useful information for reference/comparison if you have trouble, follow this link).

Google Drive is the trickiest of the remote access methods to set up. The following instructions should see you through – but if you get stumped, then don’t fear. You can buy a setup support package from our shop; or try out one of the other cloud methods (e.g. Amazon S3, Dropbox, Rackspace Cloud Files – the easiest is Dropbox). You can also try searching YouTube for videos… various people have done them, but they may be out of date, of course (and not an official resource, so don’t blame us, etc.!).

Final note before beginning: every WordPress installation you set up should have its own, unique Google API project (that’s a unique API project, as in the notes below, not a unique Google account) . Google have not documented this anywhere, but several users have found that, once they have a lot of sites, access to their Google Drive authorisation/connection can periodically fail unless this is done. This appears to be an administrative limit enforced by Google, who prefer that large-scale users use their business-focussed “Cloud Files” product (https://cloud.google.com/storage/) instead of the consumer-focussed “Drive” product, and who will only allow you to have a certain number of active authorisation tokens (connections) at once. As such, it can’t be fixed from this end, so you will need to push your limits out further by using multiple projects, but also be aware that Google do not publish their limits and that once they are hit, you may not be able to work around them. Customer feedback shows that this limit appears to be somewhere around 25 sites – but your mileage may vary.

1. Visit the Google API console, and create a new project

To allow UpdraftPlus to have access to your Google Drive account, click on the link to your API console to take you to Google; then click on “Create a Project”.

Then fill in this form (just use whatever Project ID Google suggests – it does not matter)…

2. Activate the Drive API

Open the ‘API Manager’ and find the ‘Drive API’ in the Library:

 

Note: that was Drive API, not Drive SDK. 

Follow the link, and click the ‘Enable’ button:

Google Drive Config 4

3. Set up a product name and email address

Now go to ‘Credentials’ in the left sidebar.

Google Drive Config 5

This will take you to the Credentials settings for the project. First, you will need to enter some details in the ‘OAuth consent screen’ settings (accessible through the top tabs):

Specifically, you will need to enter a product name and select an email address. If you see errors later about missing an application name or empty email address, then this is the relevant step. These details are shown back to you in step 5 (below) – Google do not use them for anything else.

 

4. Set up API access credentials (OAuth)

Move to the ‘Credentials’ tab, and click ‘Add credentials’; then click on ‘OAuth client ID’:

Google Drive Config 6

Next, enter some details:

  • Under ‘Application type’ select ‘Web application’.
  • Under ‘Name’ enter ‘UpdraftPlus’.
  • For the ‘Authorized JavaScript origins’, enter the base URL of the site. i.e. something like http://www.example.com
  • Under ‘Authorized redirect URI’, paste in the URL that was shown to you on your UpdraftPlus settings page back in your WordPress admin console: (do paste it from there – don’t copy any screenshot below)

Google Drive Config 7

 

Click ‘Create’. You will then be shown your client ID and secret.

Google Drive Config 8

5. Join the ‘Allow Risky Access Permissions By Unreviewed Apps’ Google group

Google recently implemented a verification process for Projects using certain features and scopes, in response to phishing attacks. However, they have also created a method to bypass the verification process when using Projects for personal use.

You will need to join the ‘Allow Risky Access Permissions By Unreviewed Apps’ Google group before moving to the next step. This will allow UpdraftPlus to authorise with Google Drive. After authenticating, you can then leave this group.

6. Go back to UpdraftPlus, and enter the details

You should now have a client ID and secret created. Paste the details back into the UpdraftPlus settings page in your WordPress admin console. Save the settings.

Then follow the link that WordPress will show you, to complete authorisation. The screenshot may not be identical to the one below:

Then, you’re done.

Not yet taken a look at UpdraftPlus Premium? Read more about it here…

NOTE: If the settings test or backup fails to access Google Drive, and instead returns an ‘accessNotConfigured’ or ‘InvalidScope’ error, please try joining the ‘Allow Risky Access Permissions By Unreviewed Apps’ Google group. This group was set up by Google to allow users to access personal apps without requiring the app to be reviewed under Google’s new registration process. After joining the group, attempt to re-authenticate with Google Drive and attempt a fresh backup.