# Initial Setup

## Setup for a developer

### Enable API suite for cloud project

- Navigate to Cloud Console: <https://console.cloud.google.com/>.
- Select existing cloud project or create a new one.
- Go to `APIs & Services > Enable APIs and Services`.
- Search for "Chrome".
- Select "Chrome Device Token API".
- Familiarize yourself with Terms of Service.
- Click `Enable`.

### Create Credentials

#### Create Service Account

- Go to `APIs & Services > Credentials > Create Credentials > Service account`.
- Enter service account name and click `Create`.
- Create a key for your service account. Click `Add Key` and create "json" key. Keep track of the file in a secure location.
- Use your service account with proper admin privileges for customer:
  - Customer may set up Domain-Wide Delegation and then the service account can impersonate a user/admin who has proper privileges (see [how](https://developers.google.com/chrome/chrome-device-token/guides/authorizing#enable_domain-wide_delegation))

## Setup for a customer

### Enable domain-wide delegation

- As customer admin, go to Admin Console (https://admin.google.com/).
- Navigate to `Security > Access and data control > API Controls > Domain-wide delegation`.
- Click `Add new`.
- Enter client ID ("service account unique id").
- Enter all necessary OAuth scopes. `https://www.googleapis.com/auth/chromeosdevicetoken`.
- Click `Authorize`.