Google Drive - Configuration

Last modified by Aurelie Bertrand on 2024/07/17 09:13

Configuration: Authentication data for Digdash (service account + P12 file)

Context

This document explains how to get authentication information that Digdash needs to connect to a Google Drive account.

We need the following information:

  • Service account
  • P12 file

Prerequisites

  • Être client de G Suite ou Cloud Identity
  • Être détenteur d’une ressource Organisation activé sur votre domaine.

Creating a new project

Go to your Google Cloud console at:

https://console.cloud.google.com/projectselector/home/dashboard?supportedpurview=project

google_drive_config_en_html_181801a2a7fd7771.png

 

You can either select an existing project or create a new project.

We are going to focus on the creation.

Then click on Create.

The next screen allows you to define the project. Give it a name and choose its associated Organization.Then click on Create.

google_drive_config_en_html_df76892efb913ae4.png

 

Please wait for a few seconds, the creation takes a few seconds.

  • google_drive_config_en_html_fe28954d2392b1bc.png
  • The Organization resource is the root node in the Google Cloud Platform resource hierarchy and is the hierarchical super node of projects. A project is then defined after an Organization and the choice is definitive.

Activating Google Drive API

Go to your Google Cloud console at:

https://console.cloud.google.com/projectselector/home/dashboard?supportedpurview=project

Select the new project we just created.

google_drive_config_en_html_2aabb4d8e5e905f0.png

 

google_drive_config_en_html_a731c259e2abab2a.png

 

In the left side bar, go to API & services > Library

google_drive_config_en_html_9046131ba6772a4.png

 

Get down on the page to find G Suite > Google Drive API. Click on it.

google_drive_config_en_html_42c6bf693613b351.png

 

In the next screen, click on Enable.

google_drive_config_en_html_469c99f6b2e0fa7.png

 

Creating a service account and a P12 file

In the left side bar, go to API & services > Credentials

google_drive_config_en_html_1286373fbe7a35cc.png

 

In the next screen, click on Create credentials > Service account key

google_drive_config_en_html_a068c26f94e2d318.png

 

In the next screen, select New service account in the dropdown list Service account and enter a name in Service account name. This generates a Service account ID in an email address form (ending with gserviceaccount.com).

google_drive_config_en_html_e12bda205963e9f1.png
 

In the Role list, select Project > Owner

In the options Key type, select P12 then click on Create.

google_drive_config_en_html_d7b65b751eed32aa.png
 

The P12 file will be downloaded automatically on your disk, please save it preciously. Click on Close.

google_drive_config_en_html_17b76a337cbe4f5f.png
 

In the next page, click on Manage service accounts (on the right).

google_drive_config_en_html_70fd7d22ff2995f5.png
 

Then, get the Service account ID (in an email address form).

google_drive_config_en_html_5e3c9dd16d7c4116.png
 

Precisions

Even if you created the service account while connected to your own Google account, this service account is not related - in any way - to your own Google Drive account.

The service account is a Google account in its own right and has its own Google Drive account, its own Google Calendar, etc.

When uploading to the service account, the document will go to the service account’s Google Drive and not to the Google Drive of the Google account that was used to create the service account.

NB : There is no Web interface for a service account, which means that you can’t authenticate and list which documents have been uploaded. This can only be achieved via a client able to use this service account, like Digdash.