Scope: Prime Mover Pro version
Prime Mover PRO version 1.2.5+ now supports Google Drive. So it is now possible to save or restore package from your Google Drive account. This is a PRO feature so it means you need to purchase PRO license to use this. If you already have license, please update to version 1.2.5+ so you can start using this feature.
Google Drive comes with free 15 GB storage, way bigger than other competitors like Drop Box or One Drive. This should already enough for most website backup, restoration and migration needs. You can further increase this limit by purchasing more disk space from Google Drive.
This documentation shows you how to integrate Google Drive API with your Prime Mover PRO installation. The integration process is very easy. All you need is a Google account!
Step 1: Enable Google Drive API
First, you need to make sure you have enable Google Drive API with your account.
- Login to Google API Console using your Google account.
- Click ENABLE APIS AND SERVICES , see screenshot below:
- Click Google Drive API to enable it.
- And then click Enable button to finally enable it.
Step 2: Create OAuth2 credentials
- Now you have Google Drive API enabled, you need to create OAuth2 credentials. Click Credentials link.
- Then click Create Credentials -> oAuth client ID.
- You need to get your Prime Mover Settings page URL. You will need this in the Google Drive oAuth2 setup. Login as administrator/network administrator and go to Prime Mover -> Settings. Get the URL of this settings page from the browser address bar:
- In the “Create OAuth client ID” page, enter the following details
Application Type: Web Application
Name(actually you can name anything): Prime Mover Google Drive Integration
Authorized redirect URIs: (Must be your Prime Mover settings page URL). This will vary from site to site. For example in the screenshot below it’s from a localhost.
- Finally click Create. You should be able to see OAuth client created dialog. Click OK to close.
Step 3: Save Google Drive OAuth credentials to Prime Mover PRO settings
Now you have successfully created OAuth credentials, it’s time to save it to your Prime Mover PRO settings. Prime Mover will use these credentials every time you like to connect to Google Drive API.
- Download the credentials that you have just created. This file is in JSON format. See screenshot below on how to download it. Clicking on it will download it to your Desktop.
- After downloading, open the file. Select all of the contents and copy.
- Login to your WordPress single-site or multisite (in network admin). And then paste the contents in Prime Mover -> Settings -> Google Drive OAuth 2.0 text area. It should look like this. (actual client values removed for privacy reasons)
- Click the Save button to finally save the settings. Take note that this setting is saved as encrypted to WordPress database.
Step 4: Connect to Google Drive API from Prime Mover PRO settings page
Now you have save the settings, it’s time you can connect to Google Drive API. Take note that you cannot save or restore package from Google Drive if you are not connected! This should be the first thing to check if you want to save or restore package from Google Drive.
- Login to your WordPress single-site or multisite.
- Go to Prime Mover -> Settings -> Google Drive OAuth 2.0.
- You should see a button Connect to Google Drive.
- Click the “Connect to Google Drive” button. Since you are creating the app for the first time, you might see an Unverified App warning. Just skip and proceed. This is just a reminder for you to verify your app with Google. You can do this in later stage, it will only take a couple of days (for Google to verify your app).
- If you are logging-in to your Google account via the Connect to Google Drive button, you will be presented with a consent screen. Just click Allow.
- Once logged-in, you will be redirected back to Prime Mover PRO Settings page. If you are not redirected, just repeat the above connection process or refresh the settings page (this sometimes happen when your Internet connection is unstable).
- You will know that you are connected because you see “Success! You are connected to Google Drive” message in your Prime Mover PRO settings page for Google Drive.
That’s it! You have successfully integrated Google Drive API with Prime Mover PRO plugin. Congratulations!
How to export package to Google Drive?
Once you are connected to Google Drive API, click the Export button and you should see a checkbox “Save a copy to Google Drive” under Export location.
How to restore package from Google Drive?
To restore is very simple, simply right click on the WPRIME package that is saved on Google Drive and then click “Get Link“.
And then click Copy Link.
Finally paste this URL to Prime Mover Restore Options Dialog -> Restore package from a remote URL. This is basically a remote URL feature of Prime Mover.
How to add new sites using the same configured API Credentials?
- Can I use the same API credentials to more than one sites? Yes but you must add the Prime Mover settings URI of that new site. You can do this in the Google Developer console -> Authorized Redirect URIs. See screenshot below.
- IMPORTANT: Google Drive API requires that all redirect URIs should be using HTTPS protocol.
Click the “Add URI” and then add the Prime Mover settings URL of your other site. After that , download the credentials again and use that to save to your new site. You can then connect to Google Drive.
Frequently Ask Questions on Google Drive API Integration
- Is this a persistent connection? Is it possible? Take note that once you are connected to Google Drive API. There is a one hour expiration by default. This is one hour idle time. However if you are exporting and restoring a very large package to Google Drive, it’s not going to expire because it’s not an idle connection.
- Does this use PHP sessions? No this integration does not use PHP sessions. This is to be consistent with WordPress design to be stateless.
- Can I save and restore from Google Drive API even though my app is unverified? Yes it will work but it is highly recommended to have your app to go through verification process if you want to use it often or if there are couple of users that will use it.
- Does this work in localhost? Yes but your site hostname should ONLY be “localhost”. Anything will not work. It will be blocked by Google Drive API.
- Does this work with non-HTTP protocol? No, Google Drive API requires authorized redirect URIs to use HTTPS protocol. You should be using HTTPS to use this feature. It is because you cannot add non-HTTPs redirect URIs in Google developer console.
- Does this work with Windows OS? Yes we have tested this with Windows OS using PHP.
- When restoring from Google Drive, do I need to share my package to the public? No, since you are connected and authenticated to Google Drive API, you don’t need to share your package to public.
- I already integrated with Google Drive, but I don’t see a checkbox to save package to Google Drive? Make sure you are connected to Google Drive. If you are not connected, you can never export or restore from Google Drive.