Google Drive Storage Provider Setup

The Google Drive Storage Provider allows end-users to map in their Google Drive storage into container-based sessions. Access is provided via Googles Drive’s OAuth interface and leveraging the Rclone Docker volume plugin.

Reference Docs:

Creating a Google OAuth App

  1. Login to the Google Developer Console: https://console.developers.google.com.

  2. From the APIs & Services menu, Select OAuth consent screen.

  3. Select External then click Create.

Warning

In this example, we walk through creating an integration where any Google user can auth with the Google Drive Storage Provider. This is ideal for a public facing deployment. Choose Internal if only users from your Google Workspace corporate account should be allowed to authenticate.

Extenal types will need to go through a validation process before being used in production systems.

../../_images/oauth_consent_create1.png

OAuth Consent

  1. Provide values for the App Name , User support email, and Developer Contact email.

  2. In the Authorized Domains section, enter the Workspaces deployment’s top private domain (e.g example.com).

  3. Click Save and Continue.

../../_images/oauth_consent_registration1.png

OAuth Registration

  1. Click Add or Remove Scopes.

  2. In the Update Selected Scopes window check .../auth/drive , then click Update. If the option is not available, add https://www.googleapis.com/auth/drive to the Manually add scope field and click Add To Table.

../../_images/oauth_consent_scope.png

OAuth Scope

  1. Click Save and Continue.

  2. Until the app is fully verified and published it can only be used to auth specific test accounts. Click Add Users to authorize several test google accounts.

  3. Click Save and Continue.

  4. In the APIs & Services menu, select Credentials.

  5. Select Create Credentials, then OAuth client ID.

../../_images/oauth_client_id.png

Client ID

  1. Select Web Application as the Application type, then give the client a name (e.g Kasm).

  2. Click Add URI in the Authorized redirect URIs section, and enter https://<kasm deployment hostname>/api/cloud_storage_callback.

  3. Click Create.

../../_images/create_oauth_client1.png

Create Client

  1. A dialogue will display with a Client ID and Client Secret. Save these values for the next configuration steps. The JSON download will also include URLs needed for the next configuration steps.

../../_images/client_secret3.png

Client Secret

  1. From the main menu of the Google Cloud Console , search for “Google Drive API”. Navigate to the selected page, then click “Enable” if the option is available. No action is needed if the status is currently enabled.

../../_images/enable_drive_api.png

Enable Drive

Kasm Storage Provider Config

  1. Log into the Kasm UI as an administrator.

  2. Select Settings -> Storage -> Add.

  3. Update the form with the following entries, using the Client ID and Client Secret gathered in the previous section.

Name

Google Drive

Storage Provider Type

Google Drive

Enabled

checked

Client ID

<client id>

Client Secret

<client secret>

Authorization URL

https://accounts.google.com/o/oauth2/auth

Authorization URL Options

{"include_granted_scopes" : "true", "prompt" : "select_account consent", "access_type" : "offline"}

Token URL

https://oauth2.googleapis.com/token

Redirect URL

https://<hostname>/api/cloud_storage_callback

Scope

https://www.googleapis.com/auth/drive

Default Target

/gdrive

Volume Config

{
     "driver" : "rclone",
     "driver_opts" : {
         "type" : "drive",
         "uid" : "1000",
         "gid" : "1000",
         "allow_other" : "true"
      }
}

Mount Config

{}

  1. Click Save to save the changes.

Google Drive Storage Mapping Configuration

  1. From any page, select the profile icon at the top right of the page. Select Edit Profile.

../../_images/edit_profile.png

Edit Profile

  1. Select the Cloud Storage section, then Add Storage Mapping.

../../_images/profile_add_storage_mapping.png

Add Storage Mapping

  1. Select Google Drive from the dropdown, then select Next.

../../_images/configure_storage.png

Configure Storage

  1. The Google Login page will appear. Login with the desired account. This account must have been selected as test user in the Oauth app creation process.

../../_images/login2.png

Login

  1. If the Google OAuth app is not yet approved, the user will get a warning. Click continue.

../../_images/approve1.png

Approve Kasm

  1. If successful, the user will be redirected to the Workspaces dashboard. The new storage mapping can be seen in the Cloud Storage section of the profile.

../../_images/storage_mapping1.png

Storage Mapping

  1. Launch a new container-based session. Verify the Google Drive is mapped inside the session at the /gdrive location.

../../_images/files2.png

In Session View