Google Drive

Google Drive Connector #

Register Google Drive Connector #

curl -XPUT "http://localhost:9000/connector/google_drive?replace=true" -d '{
    "name": "Google Drive Connector", 
    "description": "Fetch the files metadata from Google Drive.", 
    "icon": "/assets/connector/google_drive/icon.png", 
    "category": "cloud_storage", 
    "tags": [
        "google", 
        "storage"
    ], 
    "url": "http://coco.rs/connectors/google_drive", 
    "assets": {
        "icons": {
            "default": "/assets/connector/google_drive/icon.png", 
            "audio": "/assets/connector/google_drive/audio.png", 
            "form": "/assets/connector/google_drive/form.png", 
            "document": "/assets/connector/google_drive/document.png", 
            "drawing": "/assets/connector/google_drive/drawing.png", 
            "folder": "/assets/connector/google_drive/folder.png", 
             "fusiontable": "/assets/connector/google_drive/fusiontable.png", 
             "jam": "/assets/connector/google_drive/jam.png", 
             "map": "/assets/connector/google_drive/map.png", 
             "ms_excel": "/assets/connector/google_drive/ms_excel.png", 
             "ms_powerpoint": "/assets/connector/google_drive/ms_powerpoint.png", 
             "ms_word": "/assets/connector/google_drive/ms_word.png", 
             "pdf": "/assets/connector/google_drive/pdf.png", 
             "photo": "/assets/connector/google_drive/photo.png", 
            "presentation": "/assets/connector/google_drive/presentation.png", 
            "script": "/assets/connector/google_drive/script.png", 
            "site": "/assets/connector/google_drive/site.png", 
            "spreadsheet": "/assets/connector/google_drive/spreadsheet.png",
            "video": "/assets/connector/google_drive/video.png",
            "zip": "/assets/connector/google_drive/zip.png"
        }
    }
}'

Use google_drive as a unique identifier, as it is a builtin connector.

Using the Google Drive Connector #

To use the Google Drive Connector, follow these steps to obtain your token: Google Drive API Quickstart.

Obtain Google Drive credentials #

  1. Create your own Google OAuth App, set the Data Access as shown in the following screenshot:

Create a APP

  1. Set the Authorized Redirect URIs as shown in the following screenshot:

Authorized Redirect URIs

  1. The Google Drive connector uses /connector/google_drive/oauth_redirect as the callback URL to receive authorization responses.

  2. Once the token is successfully obtained, download the credentials.json file.

credentials.json

Important Notes: #

  • If you deploy the coco-server in your production environment, ensure you:
    • Update the domain name accordingly.
    • Adjust the callback URL or configure a custom prefix if you have an Nginx instance in front of the server.

Update coco-server’s config #

Below is an example configuration for enabling the Google Drive Connector in coco-server:

connector:
  google_drive:
    enabled: true
    queue:
      name: indexing_documents
    credential_file: credentials.json
    interval: 10s
    skip_invalid_token: true

Below is the config parameters supported by this connector.

FieldTypeDescription
enabledboolSet to true to enable the Google Drive Connector.
queue.namestringSpecifies the queue name for indexing documents.
intervaldurationInterval for polling the Google Drive API.
skip_invalid_tokenboolSkip errors caused by invalid tokens if set to true.
credentialobjectInline Google Drive API credentials.
credential_filestringPath to the credentials.json file (optional if credential is used).
client_idstringGoogle Drive client ID obtained from Google API Console.
project_idstringProject ID for the Google Drive API.
auth_uristringURI for Google authentication.
token_uristringURI to exchange tokens.
auth_provider_x509_cert_urlstringURI for Google’s certificate provider.
client_secretstringClient secret for Google Drive API.
redirect_urisstringCallback URI for authorization responses.
javascript_origins[]stringList of allowed JavaScript origins for the application.

Notes:

  • Use either credential_file or credential for providing credentials.
  • Ensure redirect_uris and javascript_origins are properly configured for your deployment.

Connect to Your Google Drive #

To connect your Google Drive, follow these steps:

  1. Visit the URL: http://localhost:9000/connector/google_drive/connect.
  2. You will be redirected to Google’s authentication page.
  3. After successfully authenticating, the connector will begin indexing your Google Drive files.

Note: Ensure that coco-server is running and configured correctly before accessing the connection URL.

Edit Edit this page