Connecting CBCloudDrive to Google Drive
Requirements: CBFSCloud
This article explains how to configure CBCloudDrive to connect to Google Drive. For a general overview of how the component works, see Getting Started with the CBCloudDrive Component.
Getting Started
First go ahead and set the ConnectionType property to ctGoogleDrive and set CacheDirectory to a valid, writable local directory path. After that, you can build a connection string using the below parameters.
Connection Parameters
| Parameter | Description |
|---|---|
| RemoteRoot | The folder within Google Drive to use as the root of the mounted drive (e.g., /Work/Projects). If left empty or set to /, the root of the Google Drive account is used. |
| SharedDrive | The ID of a Google Shared Drive (formerly Team Drive) to connect to. If left empty or set to My Drive, the authenticated user's personal drive is used. |
| OAuthClientId | The client ID assigned when registering the application in the Google Cloud Console. |
| OAuthClientSecret | The client secret assigned when registering the application. |
| OAuthAuthorizationScope | The OAuth scope to request. Must be set to at least https://www.googleapis.com/auth/drive. |
Authentication
Google Drive authentication uses OAuth 2.0. You must first register an application in the Google Cloud Console and enable the Google Drive API. Once registered, set OAuthClientId to the client ID from the console.
On the first run, the component will open a browser window for the user to authorize the application. After authorization completes, a refresh token is stored in the OAuthRefreshToken connection string parameter automatically. Save this value and include it in the connection string for all subsequent runs to avoid re-prompting the user.
drive.ConnectionType = CBCloudDriveConnectionTypes.ctGoogleDrive;
drive.ConnectionString = "RemoteRoot=/;OAuthClientId=MY-CLIENT-ID;OAuthClientSecret=MY-SECRET;"
+ "OAuthAuthorizationScope=https://www.googleapis.com/auth/drive;";
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@callback.com.