Step 1 - Create a Service Account
1. Open Service Accounts in the Google Cloud Platform. It will redirect you to the below page.
2. Select your project and click Create Service Account.
Step 2 - Service Account Details
1. Fill out the form for the Service account name, Service account ID and Service account description.
2. Click Create and Continue.
Step 3 - Grant This Service Account Access to Project
This is an optional step and can be skipped. Click CONTINUE. The project defaults to owner access.
Step 4 - Grant Users Access to This Service Account
This is an optional step and can be skipped.
Step 5 - Create Service Account Key
1. Select the account from the list of Service accounts.
2. Click Actions. Select Manage Keys from the dropdown.
3. Select Add Key > Create new key.
4. Select JSON and a new key will be downloaded. Treat your key like a password andstore it securely.
Step 6 - Delegate Domain Wide Authority
You'll need your Client ID. You can access that in two ways:
- The key you downloaded in Step E will have the Client ID.
- The Unique ID is on the Details page.
You can get your Client ID from the service accounts JSON download.
- Go to Google Workspace Admin console.
- Go to Security > API Controls.
- Under Domain wide delegation , click Manage Domain Wide Delegation.
- Click Add New
- Enter the Client ID.
In the OAuth scopes field, enter the following text:
<https://www.googleapis.com/auth/userinfo.email,https://www.googleapis.com/auth/userinfo.profile,https://www.googleapis.com/auth/calendar,https://www.googleapis.com/auth/admin.directory.user.readonly>
Click Authorize.