Skip to main content

Required Scopes

To configure a Sync for Google Drive, you need to request the following scopes from your Google OAuth application. Scopes tagged Permissions Sync are only needed if you use the Permissions API.

Account Requirements

The Permissions API is generally used when an IT administrator connects on behalf of an organization and your application needs to check which users can access the synced files.
  • Workspace admin connections: Use an account with access to the files being synced and the Admin SDK groups, membership, and audit data required by your permission sync. Being an administrator does not automatically grant access to every file in Drive.
  • Non-admin Workspace connections: Permission syncing also supports regular users through the People and Cloud Identity APIs. The connected account must be able to see the relevant files, directory entries, and group memberships. OAuth scopes do not override the organization’s directory or group visibility settings, and Admin SDK operations can still return 403 for these accounts.
    For Workspace directory lookups, ask the organization’s administrator to enable Contact sharing in the Google Admin console under Directory > Directory settings > Sharing settings. See Google’s Turn Directory on or off instructions.
    Google Admin Directory sharing settings with the Enable contact sharing checkbox unchecked and the Save button at the bottom right.

    Contact sharing is disabled in this example. Select Enable contact sharing, then Save.

    When Contact sharing is off, the People API’s people:listDirectoryPeople request can return HTTP 200 with no directory entries. A successful HTTP response alone does not confirm that organization-wide permission membership was synced.
    Group membership must also be visible to the connected account. Review Google’s Cloud Identity Groups API setup requirements with the organization’s administrator.
  • Personal Google accounts: File syncing is available, but Workspace directory and organization-wide membership requirements do not apply to personal accounts.

Enable Google APIs

In the Google Cloud Console, select the project that owns the OAuth client configured in Paragon. Navigate to APIs & Services > Library, search for each applicable API below, and select Enable:
Google Drive API page in Google Cloud with the Enable button.

Enable each API from its Google Cloud API Library page. Google Drive API is shown here.

For an integration that supports permission syncing with both admin and non-admin accounts, enable all four APIs. Enabling an API in Google Cloud is separate from requesting OAuth scopes and configuring the connected user’s Workspace permissions.

Synced Objects

Google Drive supports the following Synced Objects:
  • Files

    Google Docs, Sheets, and Slides will be synced as their Office-compatible equivalent formats:

    • Docs: DOCX file
    • Sheets: XLSX file
    • Slides: PPTX file
    • Drawings: PDF file
  • Permissions

Files

Send a request to Enable Sync to start a file sync. Syncs for Google Drive can be created with one of the following configurations:
  • Global Sync: All files in the user’s Google Drive account will be synced.
  • Folder Sync: Only files in the specified folder will be synced (recursively including all subfolders by default).
  • Sync of specific files: Only a group of specific files will be synced.
Example
Configuration options:
string[]
An optional array of MIME types to filter synced files. Only files matching the specified MIME types will be synced.
string
An optional RE2 regular expression that filters synced files by filename. Only files whose name matches the pattern are synced. Folders are always traversed regardless of the pattern.Matching is unanchored and case-sensitive. Use the inline (?i) flag for case-insensitive matches, and anchors (^, $) for exact-name matches. Lookarounds and backreferences are not supported. Patterns are limited to 1000 characters.Example: (?i)\.pdf$ syncs only PDF 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

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.
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.