> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/g/google-cloud-identity.md).

# Google Cloud Identity

Google Cloud Identity provides device enrollment and endpoint management for Google Workspace and other corporate resources. OctoXLabs reads the enrolled devices and adds them to the inventory.

## Use cases

* List the devices that Cloud Identity manages.

```
Adapters = google-cloud-identity
```

* Find managed devices that your EDR does not cover.

```
Adapters = google-cloud-identity AND NOT Adapters = falcon-crowdstrike
```

* Check what one Cloud Identity connection collected.

```
Connections = YOUR_CONNECTION_NAME
```

## Before you begin

### Network

| Source              | Destination                  | Port | Protocol |
| ------------------- | ---------------------------- | ---- | -------- |
| OctoXLabs connector | oauth2.googleapis.com        | 443  | HTTPS    |
| OctoXLabs connector | cloudidentity.googleapis.com | 443  | HTTPS    |

The port is not set in the connector code; HTTPS URLs use the default port 443. An optional HTTPS proxy can be set in the connection.

### Required permissions

| Scope or role                                                                                    | Permission | Needed for                                    |
| ------------------------------------------------------------------------------------------------ | ---------- | --------------------------------------------- |
| `https://www.googleapis.com/auth/cloud-identity.devices.readonly` (domain-wide delegation scope) | Read       | Listing devices                               |
| Workspace administrator account to impersonate                                                   | Admin      | Delegated access (`sub` of the token request) |

See [Domain-wide delegation](https://developers.google.com/identity/protocols/oauth2/service-account#delegatingauthority).

## Create credentials in Google Cloud Identity

{% stepper %}
{% step %}

### Create a service account

Open the [Service accounts page](https://console.cloud.google.com/iam-admin/serviceaccounts), select or create a project, and select **Create service account**. Enter a name and ID, then select **Create and continue**.
{% endstep %}

{% step %}

### Create a JSON key

Open the service account, go to the **Keys** tab, select **Add key** > **Create new key**, choose **JSON** and select **Create**. Upload the downloaded file in the Service Account Key File parameter.
{% endstep %}

{% step %}

### Authorize domain-wide delegation

In the Google Admin console go to **Security** > **Access and data control** > **API controls** > **Manage Domain Wide Delegation** > **Add new**. Enter the service account Client ID and the scope `https://www.googleapis.com/auth/cloud-identity.devices.readonly`.
{% endstep %}
{% endstepper %}

{% hint style="warning" %}
The key file is the only copy of the private key. Store it securely. If it is lost, create a new key.
{% endhint %}

## Connection parameters

| Parameter                | Required | Type    | Default | Description                                                                                   |
| ------------------------ | -------- | ------- | ------- | --------------------------------------------------------------------------------------------- |
| Service account email    | Yes      | String  | None    | Email address of the service account.                                                         |
| Service account key file | Yes      | File    | None    | The JSON key file of the service account.                                                     |
| Https proxy              | No       | String  | None    | Proxy URL.                                                                                    |
| Workspace admin email    | No       | String  | None    | User the application requests delegated access for. It is sent as `sub` in the token request. |
| Timeout                  | No       | Integer | 30      | Time in seconds to wait for API responses.                                                    |

## Troubleshooting

| Error message                                                                                | Cause                                                                     | Fix                                                                                         |
| -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| 403 Forbidden (the connector logs `Forbidden, status code 403.` and raises the API response) | The service account does not have the required role or API access.        | Grant the role from the permissions table and check that the API is enabled in the project. |
| 429 Too Many Requests                                                                        | Google rate limit. The connector waits 60 seconds and retries.            | No action needed. Reduce the number of projects per connection if it happens often.         |
| 401 Unauthorized                                                                             | The access token expired. The connector requests a new token and retries. | If it keeps failing, check the service account email and key file.                          |

## Change history

{% hint style="info" %}
Available starting from version 5.5.0.
{% endhint %}
