.NET Server

Creating Google Service Account and Enabling Google API

In this article

Creating Google Service Account and Enabling Google API

In this article, we will create a new Google project, add a service account to the project, generate a service account ID and a private key, enable Google Drive API and finally validate the domain on which your server is running. The Google service account ID (client_email) and a private key (private_key) will be used when creating the GSuiteEngineAsync class instance. The domain validation is required to sent Google Drive notifications about document changes to your server.

If you are running your server in the development mode, on the localhost, the domain validation is not required. However, in this case, Google Drive notification will not reach your server and file changes will be saved only when the user closes the G Suite editor and the document is unlocked.

  1. Create a new Google project. Go to Google Cloud Platform https://console.cloud.google.com/ and select IAM & Admin -> Service Accounts. 

    Create a new project in Google Cloud Platform. Select IAM & Admin->Service Accounts.

    Select Create.

    Select Create to create a new Google project.

    Provide a project name.

    Provide Google project name.

  2. Create a service account.

    Select Create Service Account in your project.

    Provide a service account name. Note the "Service account ID" field, which contains "edit-preview-documents@edit-my-dms-files-in-g-suite.iam.gserviceaccount.com" value. You will use this ID when creating the GSuiteEngineAsync class instance, passing it as the e-mail parameter. Do not confuse it with your Google account e-mail. This field will be present in the JSON file generated when creating a private key under the "client_email" name.

    Select "Create".

    Service account ID field (client_email) will be user when creating G Suite Engine.

    Live service account permissions to default.

    Do not change service account permissions.

    Create a private key. 

    Create a Google service account private key.

    Select JSON, select Create.

    Select JSON and select Create.

    Save the private key. You will be using "private_key" and "client_email" values from this file when creating GSuiteEngineAsync class.

    Save Google private key, you will be using it when creating IT Hit G Suite Engine.

  3. Enable the Google Drive API. Go to APIs & Services -> Library.

    Navigate to Google API Library. Select APIs & Services -> Library menu.

    Find the Google Drive API.

    Find Google Drive API.

    Enable the Google Drive API.

    Enable Google Drive API.

  4. Validate domain. Here you will confirm the ownership of the domain on which your IT Hit Server Engine is running.

    Go to APIs & Services -> Domain Verification.

    To verify domain go to APIs & Services -> Domain Verification.

    Follow Goggle domain verification guidelines to verify your domain.