---
myst:
html_meta:
"description lang=en": "Google Drive Storage Provider configuration guide for Kasm Workspaces"
"keywords": "Google Drive, Gdrive, Storage Provider, Storage Mapping, Cloud Storage"
"property=og:locale": "en_US"
---
```{title} Googe Drive Storage Provider Setup
```
## Google Drive Storage Provider Setup
The [Google Drive](https://www.google.com/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](https://rclone.org) Docker volume plugin.
Reference Docs:
-
-
### Creating a Google OAuth App
1. Login to the Google Developer Console: .
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.
```
```{figure} /images/storage_providers/gdrive/oauth_consent_create.png
:align: center
**OAuth Consent**
```
4. Provide values for the **App Name** , **User support email**, and **Developer Contact email**.
5. In the **Authorized Domains** section, enter the Workspaces deployment's top private domain (e.g {code}`example.com`).
6. Click **Save and Continue**.
```{figure} /images/storage_providers/gdrive/oauth_consent_registration.png
:align: center
**OAuth Registration**
```
7. Click **Add or Remove Scopes**.
8. In the **Update Selected Scopes** window check {code}`.../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**.
```{figure} /images/storage_providers/gdrive/oauth_consent_scope.png
:align: center
**OAuth Scope**
```
09. Click **Save and Continue**.
10. 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.
11. Click **Save and Continue**.
12. In the **APIs & Services** menu, select **Credentials**.
13. Select **Create Credentials**, then **OAuth client ID**.
```{figure} /images/storage_providers/gdrive/oauth_client_id.png
:align: center
**Client ID**
```
14. Select {code}`Web Application` as the **Application type**, then give the client a name (e.g {code}`Kasm`).
15. Click **Add URI** in the **Authorized redirect URIs** section, and
enter {code}`https:///api/cloud_storage_callback`.
16. Click **Create**.
```{figure} /images/storage_providers/gdrive/create_oauth_client.png
:align: center
**Create Client**
```
17. 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.
```{figure} /images/storage_providers/gdrive/client_secret.png
:align: center
**Client Secret**
```
18. 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.
```{figure} /images/storage_providers/gdrive/enable_drive_api.png
:align: center
**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.
```{eval-rst}
+-------------------------------+--------------------------------------------------------------------------------------------------------------------+
| Name | :code:`Google Drive` |
+-------------------------------+--------------------------------------------------------------------------------------------------------------------+
| Storage Provider Type | :code:`Google Drive` |
+-------------------------------+--------------------------------------------------------------------------------------------------------------------+
| Enabled | :code:`checked` |
+-------------------------------+--------------------------------------------------------------------------------------------------------------------+
| Client ID | :code:`` |
+-------------------------------+--------------------------------------------------------------------------------------------------------------------+
| Client Secret | :code:`` |
+-------------------------------+--------------------------------------------------------------------------------------------------------------------+
| Authorization URL | :code:`https://accounts.google.com/o/oauth2/auth` |
+-------------------------------+--------------------------------------------------------------------------------------------------------------------+
| Authorization URL Options | :code:`{"include_granted_scopes" : "true", "prompt" : "select_account consent", "access_type" : "offline"}` |
+-------------------------------+--------------------------------------------------------------------------------------------------------------------+
| Token URL | :code:`https://oauth2.googleapis.com/token` |
+-------------------------------+--------------------------------------------------------------------------------------------------------------------+
| Redirect URL | :code:`https:///api/cloud_storage_callback` |
+-------------------------------+--------------------------------------------------------------------------------------------------------------------+
| Scope | :code:`https://www.googleapis.com/auth/drive` |
+-------------------------------+--------------------------------------------------------------------------------------------------------------------+
| Default Target | :code:`/gdrive` |
+-------------------------------+--------------------------------------------------------------------------------------------------------------------+
| Volume Config | .. code-block:: json |
| | |
| | { |
| | "driver" : "rclone", |
| | "driver_opts" : { |
| | "type" : "drive", |
| | "uid" : "1000", |
| | "gid" : "1000", |
| | "allow_other" : "true" |
| | } |
| | } |
+-------------------------------+--------------------------------------------------------------------------------------------------------------------+
| Mount Config | :code:`{}` |
+-------------------------------+--------------------------------------------------------------------------------------------------------------------+
```
4. Click **Save** to save the changes.
```{include} /user_guide/storage_providers/gdrive.md
```