...
Expand | ||
---|---|---|
| ||
You will need to provide a valid email address belonging to a user account. The user account must have appropriate permissions, such as alert viewing. Refer to Google documentation to know how to do it. |
...
Action
...
Steps
...
Create a Project.
Info |
---|
Optional step This step is optional, if you already have a project, you do not need to create another. |
...
Login to Google APIs console.
In the search bar, search Create a Project.
Click on Create a Project.
Fill in the required fields.
Click on Create.
...
Enable Google Workspace Alert Center API.
...
Login to Google APIs console.
In the search bar, search Workspace Alert Center API.
Click on Google Workspace Alert Center API.
Click on Enable to activate the API.
...
Create credentials.
...
In the search bar, search Credentials.
Click on Credentials (APIs & Services).
In the Service Accounts section, click on Manage service accounts.
Click on the + Create service account button.
Enter a Service account name and click Done.
Click on the Email field of the created service account to access its details.
Copy and save the Unique ID of the created service account.
Click on the Keys tab.
Click on Add key button.
Click on Create new key. A pop-up window will open to select the details of the key.
In key type select JSON.
Click on the Create button.
The file with the credentials will be downloaded automatically.
Rename the file
credentials.json
.Save the file in
<any_directory>/devo-collectors/gsuite-google-workspace-alerts/credentials/
Convert the content of the
credentials.json
tobase64
. Recommended method using Python version higher or equal 3.6Copy the Python script below:
Code Block import base64 def main(): with open('credentials.json', 'r') as credentials: creds_as_bytes = credentials.read().encode('utf-8') base64creds = base64.b64encode(creds_as_bytes).decode("utf-8") print(f'Base64 encoded credentials.json: {base64creds}') if __name__ == '__main__': main()
Save the script to
<any_directory>/devo-collectors/gsuite-google-workspace-alerts/credentials/
.Rename it to
b64encoder.py
.Run the command below in the
<any_directory>/devo-collectors/gsuite-google-workspace-alerts/credentials/
directory.Code Block $ python b64encoder.py
The script will output a line starting with
Base64 encoded credentials.json:
Copy the base64 value as this will be required for the collector configuration.
Copy the content of the json file. You can use any free software to convert the content of the json file to base64.
Paste it into a base64 encoder and copy the result.
Info |
---|
Save base64 value It is important to save the base64 value to later run the collector on-premise and in the collector server. |
Info |
---|
Unique ID The Unique ID (step 7) will be used later in the domain delegation. |
Note |
---|
Don’t use base64 encoders Online base64 encoders are not recommended for security reasons. |
...
Authorize the service account through Domain Wide Delegation.
Once the service account is created and with credentials, it is necessary to authorize it through Domain Wide Delegation.
Login in the google administration console: https://admin.google.com/.
In the left menu select Security → Access and data control → API controls.
Click Manage domain wide delegation in the Domain wide delegation section.
Click on Add new. A pop-up window will open to enter the details.
In Client ID field enter the previously copied Service Account Unique ID.
In OAuth scopes field add the following:
https://www.googleapis.com/auth/apps.alerts.
Finally click on Authorize.
Info |
---|
Delegated email You can copy the email used to login to https://accounts.google.com/ to later use it as |
...
Use a real email
...
. |
Minimum configuration required for basic pulling
...