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.
-
Create a new Google project. Go to Google Cloud Platform https://console.cloud.google.com/ and select IAM & Admin -> Service Accounts.
Select Create.
Provide a project name.
-
Create a service account.
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".
Live service account permissions to default.
Create a private key.
Select JSON, select Create.
Save the private key. You will be using "private_key" and "client_email" values from this file when creating GSuiteEngineAsync class.
-
Enable the Google Drive API. Go to APIs & Services -> Library.
Find the Google Drive API.
Enable the Google Drive API.
-
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.
Follow Goggle domain verification guidelines to verify your domain.