# Google Drive Plugin

This tutorial explains how to create Google Drive-based read/write storage backend for Wildland containers.

# Obtaining user credentials

  1. Create a new project on the developer console via: https://console.cloud.google.com/projectcreate (opens new window).

    Create new project

  2. Select SELECT PROJECT.

    SELECT PROJECT

  3. On the project page, select Go to APIs overview.

    Go to APIs overview

  4. Click ENABLE APIS AND SERVICES.

    ENABLE APIS AND SERVICES

  5. Search for Google Drive API, select it and press Enable.

    Google Drive API

  6. When API is enabled, you will see a warning message on the dashboard, which will say: To use this API, you may need credentials. Click 'Create credentials' to get started.. Click the CREATE CREDENTIALS next to it.

    CREATE CREDENTIALS

  7. There will be a wizard asking for the credential type. Select Google Drive API and User Data and press NEXT.

    Credential Type

  8. The second Wizard screen is OAuth consent screen, fill in the necessary parts and Click SAVE AND CONTINUE.

    OAuth consent screen

  9. The third Wizard screen is Scopes, skip this screen by simply pressing SAVE AND CONTINUE.

  10. The fourth screen is OAuth Client ID. Select Desktop App as Application type and the Name field can remain as it is, then click the CREATE button.

    OAuth Client ID

  11. On the final screen, Google will show your Client ID and give an option to download application credentials in JSON format, which is what we are looking for. Press DOWNLOAD. We don’t need the Client ID itself.

    Download application credentials

    This is an example of what you will find in the downloaded JSON file.

    {
      "installed": {
        "client_id": "{CLIENT_ID}.apps.googleusercontent.com",
        "project_id": "{PROJECT_ID}",
        "auth_uri": "https://accounts.google.com/o/oauth2/auth",
        "token_uri": "https://oauth2.googleapis.com/token",
        "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
        "client_secret": "{CLIENT_SECRET}",
        "redirect_uris": ["urn:ietf:wg:oauth:2.0:oob", "http://localhost"]
      }
    }
    
  12. After downloading the file, press OK, this will take you back to the project's credentials page. Select OAuth consent screen from the side menu and under the Publishing status section, press the PUBLISH APP button. We’re done here.

    PUBLISH APP

# Creating Google Drive storage

$ wl c create YOUR_CONTAINER_NAME
$ wl storage create googledrive --inline --container YOUR_CONTAINER_NAME --credentials 'CONTENT_OF_CLIENT_CONFIG_JSON_IN_BETWEEN_SINGLE_QUOTE'

# Mounting

$ wl start
$ wl c mount YOUR_CONTAINER_NAME

# Google Drive documentation