Creating Google Drive client ID and secret
Creating a client ID and secret for Google Drive is very similar to creating a client ID and secret for Gmail, with the difference being the scopes that are used. Scopes define what can be done by the application that uses the client ID and secret. SyncBackPro requires three scopes for use with Google Drive:
- .../auth/userinfo.email (a non-sensitive scope, required to see your primary Google Account email address)
- .../auth/userinfo.profile (a non-sensitive scope, required to see your personal info, including any personal info you've made publicly available)
- .../auth/drive (a restricted scope, required to access Google Drive)
The Steps
Although it looks overwhelming, it is relatively simple to give SyncBackPro access to Google Drive:
- First we create a project and give it a name.
- Next we tell Google we want this project to use Google Drive and we will authorize using OAuth.
- We then define what access SyncBackPro has to Google Drive by specifying the Scopes it will require.
- To limit access, we define which Users can connect by adding their email addresses to the project.
- Finally we Publish it, which basically means it is made available for you to use.
- When SyncBackPro first connects to Google Drive using this project, you will need to approve it.
Creating a Project
First, we must create a project:
- Go to the Google Developers Console: https://console.cloud.google.com/
- Click the Select a project drop-down menu on the top-left corner of the page. A pop-up window appears on the screen.
- Click New project on the top-right of the pop-up window.
- Enter a Project name, e.g. SyncBack Google Drive, then click the Create button. It may take a while for the project to be created.
OAuth
Now we have a project we must state that it is for Google Drive access and SyncBackPro will authenticate with using OAuth:
- Click the burger menu on the top-left of the window and select Enabled APIs & services.
- Check that you have selected your Google Drive project (at the top-left), then click + Enable APIs and services at the top of the window.
- Enter google drive into the search box and press Enter
- Click the Google Drive API box...
- ...then click the Enable button. It may take a few moments to enable it.
- Once enabled, click OAuth consent screen on the left of the window.
- The OAuth overview screen will eventually appear. Click the Get started button
- Enter an app name, e.g. SyncBack Google Drive, and use your own Gmail email address for the user support email, then click the Next button.
- Set the Audience as External then click the Next button.
- Use your own Gmail email address for the contact information then click the Next button.
- Tick the agreement checkbox then click the Continue button followed by the Create button. It will take a few moments to process.
- Click the Create OAuth client button.
- For the Application type select Desktop app
- Enter a Name, e.g. SyncBack Google Drive, then click the Create button.
- Once it has been created, a pop-up window will appear with details. Click the OK button to continue.
Scopes
We now configure what access SyncBackPro will have to Google Drive. This is done by using Scopes:
- Select Data access in the menu on the left of the window, then click the Add or remove scopes button. A new window appears on the right side of the screen.
- In the Filter table, tick the userinfo.email and userinfo.profile checkboxes.
- In the Enter property name or value edit box, enter drive and press Enter. Tick the Google Drive API checkbox with the Scope .../auth/drive then click the Update button at the bottom.
- You should see three scopes listed: userinfo.email and userinfo.profile in Your non-sensitive scopes, and /auth/drive in Your restricted scopes. It is critically important those three scopes are there. If not, repeat the steps above. If all three are listed, click the Save button at the bottom of the window. It may take a few moments to save.
Users
Now we need to define which users can use this project. If you don't add the Google Drive email addresses you want to use then this will not work:
- Select Audience from the menu on the left of the window and click + Add users
- Enter your email address (the email address you will use in SyncBackPro to access Google Drive). You can add multiple email addresses. Click Save once you've added all the email addresses. It may take a few moments.
Downloading Credentials
We can now download the credentials that will be used by SyncBackPro to access Google Drive. They can be downloaded to a JSON file, which SyncBackPro can then use.
- First, select Clients in the menu on the left of the window, then click on the SyncBack Google Drive entry that we've just created (you may have given it a different name):
- Additional information will appear on the right of the browser window. IMPORTANT: If you're browser window is not wide enough then nothing will appear. Click the download button to download the credentials to a JSON file. Take note of where that file is downloaded to as it will be required by SyncBackPro.
Publish
Finally, we can make the project available to use by SyncBackPro:
- Click the Audience link on the left then click the Publish app button.
- A pop-up window appears (Push to production?). Click Confirm. It may take a few moments to process.
- Congratulations! You can now use SyncBackPro to access Google Drive. IMPORTANT: Do not click Go to verification centre or Prepare for verification. It is not required or necessary.
Using it with SyncBackPro
When you first connect to Google Drive from SyncBackPro, Google will need you to approve it:
- First, you will receive a warning about the app not being verified. Click Advanced:
- Next, click the Go to SyncBack Google Drive (unsafe) link - note that the exact text depends on what you named your project:
- Next, click the Continue button:
- Click the Select all checkbox at the top, then click Continue:
- You will now get a confirmation message. Return to SyncBackPro and it will also confirm that SyncBackPro is authorized: