Google Drive

Google drive is a file storage and synchronization service developed by Google. This component allows you to create, copy, download, update, list, and delete files stored in a Google drive account.

 

Authorization

OAuth2

The Google drive component authenticates requests through the Google cloud platform (GCP) OAuth 2.0 service. You'll need to create a GCP OAuth 2.0 app so your integration can authenticate and perform Google drive tasks on your customers' behalf.

To create a Google drive OAuth 2.0 app, first, make sure you have a Google developer account: you can sign up at https://console.cloud.google.com/. Then:

  1. Open up the Google Drive API console: https://console.cloud.google.com/apis/api/drive.googleapis.com

    Click create project if you would like to develop a new GCP project, or select an existing project.

    You will be prompted to enable Google drive API for your project. Click enable.

    On the sidebar, select credentials.

  2. An OAuth 2.0 app includes a "consent screen" (the page that asks "do you want to allow (your company) to access Google drive on your behalf?"). Click on configure consent screen.

    1. Your app will be externally available to your customers, so choose a user type of external.

    2. Fill out the OAuth consent screen with an app name (your company or product's name), support email, app logo, domain, etc.

    3. You can ignore domains for now.

    4. On the next page, ignore scopes: this component knows what scopes it needs to run and will request the right scopes for you.

    5. Enter some test users for your testing purposes. Your app will only work for those testing users until it is "verified" by Google. When you are ready for verification (they verify your privacy policy statement, etc), click publish app on the OAuth consent screen. That'll allow your customers to authorize your integration to access their Google drive.

  3. Once your "consent screen" is configured open the credentials page from the sidebar again.

  4. Click +create credentials and select OAuth client id.

    1. Under application type select web application.

      Under authorized redirect URIs enter Sapper's OAuth 2.0 callback URL: https://automation.sapper.ai/#/signup click create.

  5. Take note of the client id and client secret that are generated for future use.

 

Now that you have a client id and client secret, add Google drive step to your integration in Sapper. Open the configured variables drawer, select your Google drive connection and enter your client id and secret.

Google drive Connections

Google drive OAuth2.0 Connection

 

Input 

Key 

Description

Example

Select application

application

Select Google drive application

 

Connection type

connection type

Select the type of connection.

 REST

REST connection type

rest connection type

Select the type of REST connection.

 OAuth2.0

Connection name

name

Provide a name for the connection.

 Google drive connection

Connection description

description

Provide a description for the connection.

 

Host name

host 

Provide a string value for the URL of user's Google drive account.

 

Grant type

grant type

Provide the grant type - authorization code, password, client credentials.

 

Actions 

Create Folder

Create folder for all users | key: createFolder

Input

Key

Description

Example

Input

Key

Description

Example

Title

title

Provide an appropriate title for the folder

 

Mime Type

mimetype

Enter the mime type.

application/vnd.google-apps.document

Writers can share

writersCanShare

Provide the information if writer can share the folder or not.

 


Create folder in Drive

Create folder in Drive for all users | key: createFolderinDrive

 

Input

Key

Description

Example

Input

Key

Description

Example

Title

title

Provide an appropriate title for the folder

 

Mime Type

mimetype

Enter the mime type.

application/vnd.google-apps.document

Writers can share

writersCanShare

Provide the information if writer can share the folder or not.

 


Search file or folder in Drive

Search file or folder in Drive | key: searchfileorFolderinDrive

Input

Key

Description

Example

Input

Key

Description

Example

Name of file

nameofFile

Provide an appropriate file name for searching it in the Google Drive

 Sample