Required Scopes

To configure a Sync for Google Drive, you need to request the following scopes from your Google OAuth application:
  • https://www.googleapis.com/auth/drive.readonly
  • https://www.googleapis.com/auth/admin.reports.audit.readonly (optional - for ingesting Permissions Sync link sharing access)
Learn more about configuring scopes for your app in Adding Integrations.

Synced Objects

Google Drive supports the following Synced Objects:

Files

Sync Configuration Options

Example
{
    "integration": "googledrive",
    "pipeline": "files",
    "configuration": {
        "folderId": "1DBmDMhWTzNapG2sSiu7-u7lkSCJnyC34"
    }
}
folderId
string
A Google Drive Folder ID to limit the Sync scope to. If not specified, the Sync will ingest all available files.

Choosing Files and Folders

You can allow your user to select files from their Google Drive account in your app with the Google Drive File Picker provided by the Paragon SDK.
Enable the Google Picker API You will need to enable the Google Picker API for your application in order to access the File Picker.
  1. In your Google Cloud Console dashboard, navigate to APIs & Services > Library in the sidebar for your app.
  2. Search for “Google Picker API” from the API Library.
  3. Select the “Google Picker API” and press the blue “Enable” button to enable the API for your application.
Creating a Google Drive API Key To show the Google Drive File Picker, you will need a Google Drive API Key. This key is a separate key from the Client ID you provided to Paragon during integration setup.
  1. Navigate to Google Cloud Console > APIs & Services > Credentials. Make sure the selected project in the header is your app.
  2. Click Create Credentials and select API key.
  3. An API key value will appear. Copy this value to use in Showing the File Picker.
Note: While the API Key value is not sensitive and can safely be used in your public application, we recommend restricting the API Key with the following settings:
  • Application restrictions: Websites with your origin/domain
  • API restrictions: Google Drive API
Read more in Google’s docs for API Key restrictions.

Showing the File Picker

You can allow your user to select files from their Google Drive account in your app with the Google Drive File Picker provided by the Paragon SDK.
Enable the Google Picker API You will need to enable the Google Picker API for your application in order to access the File Picker.
  1. In your Google Cloud Console dashboard, navigate to APIs & Services > Library in the sidebar for your app.
  2. Search for “Google Picker API” from the API Library.
  3. Select the “Google Picker API” and press the blue “Enable” button to enable the API for your application.
Creating a Google Drive API Key To show the Google Drive File Picker, you will need a Google Drive API Key. This key is a separate key from the Client ID you provided to Paragon during integration setup.
  1. Navigate to Google Cloud Console > APIs & Services > Credentials. Make sure the selected project in the header is your app.
  2. Click Create Credentials and select API key.
  3. An API key value will appear. Copy this value to use in Showing the File Picker.
Note: While the API Key value is not sensitive and can safely be used in your public application, we recommend restricting the API Key with the following settings:
  • Application restrictions: Websites with your origin/domain
  • API restrictions: Google Drive API
Read more in Google’s docs for API Key restrictions.

Showing the File Picker

Use the Paragon SDK in your frontend application to show the File Picker in your app. The SDK provides an ExternalFilePicker class to load Google’s JavaScript into your page and authenticate with your user’s connected Google Drive account. To initialize the picker you will need your Google Drive API key and your Google Cloud project number. The Google Cloud project number is a unique, numerical identifier for your project. You can find it within the Google Cloud Console from the sidebar navigation under IAM & Admin section > Settings.
let picker = new paragon.ExternalFilePicker("googledrive", {
    onFileSelect: (files) => {
        // Handle file selection
    }
});

// Loads external dependencies and user's access token
await picker.init({ developerKey: "YOUR_GOOGLE_API_KEY", "appId": "YOUR_GOOGLE_PROJECT_NUMBER" });

// Open the File Picker
picker.open();
You can configure the File Picker to listen for additional callbacks or to restrict allowed file types. Learn more about configuring File Picker options in the SDK Reference.