Project configuration in Google API Console – use of Google Service Account. The ‘Google Workspace friendly application’ series.

22 grudnia 2020 Wojciech Sowa

The ‘Google Workspace friendly application’ series – table of contents

  1. What is Google Workspace, and why should we integrate with it?
  2. Project configuration in Google API Console – use of Google API Client Library for JavaScript – Part I.
  3. Project configuration in Google API Console – use of Google API Client Library for JavaScript – Part II.
  4. Configuration of Oracle Database and APEX application – use of Google API Client Library for JavaScript.
  5. Project configuration in Google API Console – use of Google Service Account.
  6. Configuration of Oracle Database and APEX application – use of Google Service Account.

Introduction

Recently we talked about the integration of APEX and Google Workspace using the JavaScript library. In this article, I will present an approach based on the „Service Account”, which can be used in processes taking place without the participation of the application user, such as database jobs or processes responsible for importing data.

The first step in our integration will be the configuration of the Google API environment. We will perform the steps of creating a new project and selecting the API libraries needed to complete the sample task. Finally, we will create a technical user who will communicate with the Google API.

Step by step guide

Go to https://console.developers.google.com/start – use the Google account in your organization’s domain to log in.

From the 'APIs & Services' menu, select 'Dashboard', and then select the available option 'Create Project'. 

If you already have any other project created in your account, its name will be visible instead.

Click on this, and in the pop-up window that opens, select the “New project” option in the top right corner.

On the new project configuration screen, enter its name and click the ‘Create’ button.

After creating the project, you will be automatically redirected to it. However, if this has not happened, select the newly created project from the project selector.

From the menu on the left side, go to the ‘Library’ tab. The entire library of available Google APIs appears. For our example, let’s say that we will need the ‘Google Drive API’ library. Find it and then choose it. On the summary screen, click the ‘Enable’ button.

After activating the API, you will be taken to the ‘Overview’ section, where there is information about it. You will find information about the usage statistics over various periods and links to documentation and tutorials.

Select the 'Credentials' option from the menu available on the left, and then select the '+ Create Credentials' option from the top bar. Select the 'Service account' option from the available menu.

In the first step of the wizard, enter the name of our 'Service account' account. The 'Service account ID' property is created automatically. The account description is an optional field. Click the 'Create' button. Steps 2 and 3 are optional. Click the 'Done' button.

You will be redirected to the main page of the 'Credentials' section. We can see that a newly created account appeared in the 'Service Accounts' section. Select that, and on the next page in the 'Keys' section, choose the 'Create new key' option in the recommended JSON format. You will be asked to select a place on the disk where our account’s private data will be saved.  Click the 'Save' button.

The extra, optional step is to authorize the created 'Service Account' by the Google Workspace administrator in your organization. This part is crucial if you want to use 'Service Account' to manage all users' Google content, particularly the Google Workspace domain. Detailed information on this topic is provided in the official Google documentation. See paragraph 'Delegating domain-wide authority to the service account'. https://developers.google.com/identity/protocols/oauth2/service-account#creatinganaccount.

The configuration of Google Workspace is done. The API to manage Google Drive is now enabled and ready to use in your APEX application. The next step is to discover this API and implement the access authorization mechanism. It will be described in the forthcoming article. Most of the Google API capabilities are accessed via the OAuth 2.0 protocol. https://developers.google.com/identity/protocols/oauth2.

Tagi: , , , ,

Zapraszamy do kontaktu!

Pretius jest firmą tworząca oprogramowanie wspierające biznes.
Tworzymy aplikacje webowe wykorzystując: Java, Oracle DB, Oracle Apex, AngularJS.
Skontaktuj się z nami, aby porozmawiać o tym jak możemy pomóc w realizacji Twojego projektu!