Skip to main content
Kinetic Community

Google Drive Adapter

Overview

The Google Drive Adapter is an adapter that is installed into Kinetic Bridgehub that retrieves files and folders from an authenticated Google Drive account.

Installation

Note: Check to ensure that this adapter isn't already installed into your bridgehub as part of the base installation before undertaking the installation tasks.

  • Download the kinetic-bridges-adapter-googledrive.jar file and it's dependencies here
  • Put all of the downloaded files into the WEB-INF/lib folder for you kinetic-bridgehub installation
  • Restart the tomcat that your kinetic-bridgehub installation is located in
  • If you want to use the bridge to create expiring links for Google Drive files, see the page for Setting up Expiring Links in Google Drive.

Setup

Configuration Values

Name Description
Service Account Email Email of the Service Account configured with the Google Drive API
P12 File Location P12 file associated with the Service Account
Impersonated User Email Email of the user to be used to access Drive data
Google Apps Expiration Script Url (Optional) If configured, the Url location for the Google Apps Expiration Script

Example Configuration

Name Value
Service Account Email 103529480642997-p1np6lweiqy98271iorill6jj@developer.gserviceaccount.com
P12 File Location /home/test.user/p12files/93c49ca972a1234ttewyhrteqpoiweru82-privatekey.p12
Impersonated User Email test.user@acme.com
Google Apps Expiration Script Url (Optional) https://script.google.com/a/macros/acme.com/s/AKfycbxSTG8tRJaWQS8fLWp_IVmwuqLkmcUE3-_JOJOSfQWDYtFd8mQ/exec

 

Configuration Details

How to retrieve the Service Account Email and Setup P12 File

For the bridge to authorize with the Google Drive API properly, it needs a configured Service Account, an associated P12 file as well as allowing domain-wide delegation of authority on that service account (to allow it to impersonate the user configured in Impersonated User Email). The instructions below show you how to go through this setup process. Note: Google tends to change their console frequently, so if the steps going page by page through the console don't seem to match up just follow the general process. The process to setting up the accounts should be the same, even if the consoles look/navigate slightly different.

To enable the Google Drive API and get the Service Account Email and P12 file

  1. Navigate to the 'Google Developers Console' (Google 'Google Developers Console' to find it. The link changes)
  2. Click on the Create Project button (or if you have an existing project that you wish to keep using, click on the project name.)
  3. Go to the APIs page and turn on the Google Drive service
  4. Go to the Credentials page and create a new Client Id
    • Select 'Service Account'
    • Select 'P12 Key' for key type
  5. When you click 'Create Client Id', a P12 file will be downloaded
  6. Remember the email for the Service Account and the location fo the downloaded P12 file

How to Perform Domain-Wide Delegation of Authority to Allow Impersonation

  1. Go to the admin console in your Google Apps domain
  2. Select Security from the list of controls. If you don't see Security listed, the menu will likely need to be expanded to include More Controls
  3. Select advanced settings from the list of options
  4. Select manage third party OAuth Client access in the authentication section
  5. In the client name field enter the service account's Client Id
  6. In the one or more API scopes field enter the list of scopes that you application should be granted access to
    • For Google Drive, you should enter https://www.googleapis.com/auth/drive
  7. Click the authorize button

Structures, Fields, and Queries

Structures

  • Files
    • To be used when searching the top level of Google Drive (ie. not inside a folder).
  • Folders
    • To be used when searching the contents of a specific folder. When using this structure, the query will need to include folderId = '{folder id}' so that the bridge knows which folder to retrieve the contents from.

Fields

The fields that are currently available for this bridge are:

  • title
  • id
  • fileSize
  • lastModifiedUser
  • lastModified
  • owners
  • downloadUrl
  • kind
  • alternateLink
  • expiring link (retrieve only, and only if it has been previously configured)

Queries

Information for how to write qualifications to search Drive files can be found in the Google Drive API documents, which can be found here.

Pagination

This bridge uses the Google Drive API, which uses a token based pagination instead of normal pageSize, pageNumber, offset type. If no pagination data is passed, the bridge will return the biggest chunk allowed by the API. If you want to use pagination, to advance to the next page you need to:

  • Increment the pageNumber by 1
    • Because of the token based pagination, skipping pages is not currently allowed by the bridge
  • Add a pageToken
    • Grab the token you want (either prevToken or nextToken) from the previous requests metadata and add that to your current request.

Changelog

v1.0.0 (2016-04-13)

  • Initial Version