Service Account Creation
First a service account and its credentials need to be created. During this procedure information that will be used later for the G Suite domain-wide delegation of authority and in the code to authorize with the service account needs to be gathered. The following items required later are service account's:
-
Client ID
-
Private key file
-
Email address.
To create a Service Account:
-
Open the Service accounts page: https://console.developers.google.com/iam-admin/serviceaccounts. If prompted, select a project.
-
Click Create service account.
-
In the Create service account window, type a name for the service account.Note: The next two steps are optional.
-
Once the service account is created, click it to open its settings. Open the Show Domain-wide Delegation menu, check Enable Google Workspace Domain-Wide Delegation and click Save.
-
In the same window, copy the Email and the Unique ID of the service account.
-
Go to KEYS and click ADD KEY, then select Create new key, to create a private key for the service account.
-
Select the key type JSON and click Create.
-
Your new public/private key pair is generated and downloaded to your machine; it serves as the only copy of this key. Keep it in a secure location.
Related information