Authorization Type

Carbon uses OAuth 2.0 to connect to Google workspace.

Functionality

Carbon has the ability to synchronize files and folders from Google Drive. Google Slides, Google Docs and Google Sheets are supported, along with regular text, audio, video, and image files.

Google has a limit of 10 MB per file, so a single uploaded file cannot exceed 10 MB.

Authorization Flow

Log into your Google Drive account.

Once you’ve successfully authenticated your account, you can select files directly.

Click “Select” after selecting files to grant Carbon access to files.

Configuration

Custom OAuth Credentials

Custom OAuth credentials is only required for customers who enable white labeling.
  1. Go to APIs and Services > Enabled APIs and Services in your Google Cloud console, then click on the button titled ENABLE APIS AND SERVICES and enable Google Drive API and Google Picker API.
  2. Then create an OAuth Client ID in the Credentials section under Google Drive API. Select Web Application as the Application type and give it an identifiable name for your reference.

  1. Add https://api.carbon.ai as the Authorized JS origin and https://api.carbon.ai/integrations/google as an Authorized redirect URI. You can also opt to use a custom CNAME record pointing to https://api.carbon.ai for the Authorized JS Origin and Authorized redirect URI. However, for the Authorized redirect URI the domain paths must still be /integrations/google.

  1. Save the credentials. Download the credentials.json file once you save the OAuth Client ID data and share the file with Carbon.

  1. Then create an API key in the Credentials section under Google Picker API. Restrict the application to websites and then add https://api.carbon.ai (or your custom CNAME) to the list under website restrictions. For API Restrictions, pick Restrict key and select Google Picker API from the list.

  2. Save the API key. Copy the API key and share it with Carbon.

  3. Configure your consent screen in the OAuth Consent Screen. Provide your App name, support email address, and brand logo. Add carbon.ai (or your custom CNAME) to Authorized domain.

  1. Click on Add or Remove Scopes button to add the following scopes: userinfo.profile, userinfo.email, drive.readonly, drive.metadata.readonly

  1. If you wish to add test users, you can do so. These users will not see the “App is unverified” notification. Other users will see this alert.
  2. Click Publish App to make this app available to your end-users.

Synchronization

Syncs are triggered when end-users add or remove Google Drive files and folders via the Google Drive picker. When a user selects a folder to be synced, we auto-sync all files added to the folder as well.

You can use the resync_file API endpoint to programmatically resync specific Google Drive files.

To sync Google Drive files on a 24-hour schedule (more frequent schedules available upon request), you can use the /update_users endpoint. This endpoint allows organizations to customize syncing settings according to their requirements, with the option to enable syncing for all data sources using the string ‘ALL’. It’s important to note that each request supports up to 100 customer IDs.

Here’s an example illustrating how to automatically enable syncing for updated Google Drive content for specified users:

{
    "customer_ids": ["team@carbon.ai", "sam@openai.com"],
    "auto_sync_enabled_sources": ["GOOGLE_DRIVE"]
}