August 17, 2023

tGoogleDriveConnection – Docs for ESB 5.x

tGoogleDriveConnection

tgoogledriveconnection_icon32.png

tGoogleDriveConnection properties

Component family

Cloud / Google Drive

 

Function

This component opens a connection to access a Google Drive
account.

Purpose

This component allows you to open a Google Drive connection that
can be reused by other Google Drive components.

Basic settings

Application Name

Enter the application name required by Google Drive to get access to its APIs.

 

Access Token

Enter the access token required by Google Drive to access a Google Drive account and operate
it. For how to get the access token, see Obtaining an access token for Google Drive.

 

Use HTTP Proxy

Select this check box if you are working behind an HTTP proxy.

 

Proxy Host

Enter the IP address of the HTTP proxy server.

This field is available only when the Use
HTTP Proxy
check box is selected.

 

Proxy Port

Enter the port number of the HTTP proxy server.

This field is available only when the Use
HTTP Proxy
check box is selected.

 

Use SSL

Select this check box if an SSL connection is used to access Google Drive.

 

Algorithm

Enter the name of the SSL cryptography algorithm.

This field is available only when the Use
SSL
check box is selected.

 

TrustStore File

Browse to or enter the path to the certificate TrustStore file that contains the list of
certificates the client trusts.

This field is available only when the Use
SSL
check box is selected.

 

Password

Enter the password used to check the integrity of the TrustStore data.

This field is available only when the Use
SSL
check box is selected.

Advanced settings

tStatCatcher Statistics

Select this check box to gather the Job processing metadata at the Job level as well as
at each component level.

Global Variables

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see Talend Studio
User Guide.

Usage

This component is more commonly used with other Google Drive components. In a Job
design, it is usually used to open a Google Drive connection that
can be reused by other Google Drive components.

Limitation

n/a

Obtaining an access token for Google Drive

To use Google Drive APIs, you need first to obtain the access token by completing the
following steps using Google Chrome with the REST Console extension installed:

  1. Go to the Google Developers
    Console
    and select an existing project or create a new one. In this
    example, we create a new project TalendProject.

    components-tgoogledriveconnection_getaccesstoken01.png
  2. Select the newly created project, click APIs under
    APIs & auth and enable both the
    Drive API and Drive
    SDK
    APIs by setting their status to ON.

    components-tgoogledriveconnection_getaccesstoken02.png
  3. Click Consent screen under APIs & auth and create a new product. In this
    example, it is TalendProduct.

    components-tgoogledriveconnection_getaccesstoken03.png
  4. Click Credentials under APIs &
    auth
    , create a new client ID with APPLICATION TYPE set as Installed
    application
    and INSTALLED APPLICATION
    TYPE
    set as Other.

    components-tgoogledriveconnection_getaccesstoken04.png

    The created CLIENT ID, CLIENT
    SECRET
    , and REDIRECT URIS will
    be used for obtaining the access token.

    components-tgoogledriveconnection_getaccesstoken05.png
  5. Generate the authentication code by performing an HTTP GET request using a web browser. To
    do this, copy and paste the request URL https://accounts.google.com/o/oauth2/auth with the following
    query string parameters into your web browser’s address bar, press Enter and accept the access request.

    • client_id: the value of CLIENT ID from the Credentials view.

    • redirect_uri: the value of REDIRECT URIS from the Credentials view.

    • response_type: the value is code.

    • scope: the auth scope that expresses
      the permissions you request users to authorize for your app. For more
      information, see https://developers.google.com/drive/web/scopes.

    • access_type: the value is online.

    components-tgoogledriveconnection_getaccesstoken06.png

    Note that the request URL and the query string parameters are concatenated with a question
    mark ?, and every two query string parameters
    are concatenated with an ampersand &. An
    example URL is shown below, with line breaks for readability. You need to join
    all these lines into one line before copying and pasting the URL into your web
    browser’s address bar. The scope used in this example has full, permissive scope
    to access all of the user’s files. Request this scope only when it is strictly
    necessary.

    The response returned contains an authorization code that will be used to generate the
    access token in the next step.

    components-tgoogledriveconnection_getaccesstoken07.png
  6. Generate the access token by performing an HTTP POST request using Google REST Console. To do this, copy and paste the request URL
    https://www.googleapis.com/oauth2/v3/token with the following
    query string parameters into the Request URI
    field in the Target area, select the Content-Type check box and set its value to application/x-www-form-urlencoded, then click the
    POST button.

    • code: the authorization code
      generated in the previous step.

    • client_id: the value of CLIENT ID from the Credentials view.

    • client_secret: the value of CLIENT SECRET from the Credentials view.

    • redirect_uri: the value of REDIRECT URIS from the Credentials view.

    • grant_type: the value is authorization_code.

    components-tgoogledriveconnection_getaccesstoken08.png

    Note that the request URL and the query string parameters are concatenated with a question
    mark ?, and every two query string parameters
    are concatenated with an ampersand &. An
    example URL is shown below, with line breaks for readability. You need to join
    all these lines into one line before copying and pasting the URL into the
    Request URI field.

    The response returned contains the access token. Note that the access token
    expires in every 3600 seconds.

    components-tgoogledriveconnection_getaccesstoken09.png

Related scenario

For a related scenario, see Managing files with Google Drive.


Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x