> For the complete documentation index, see [llms.txt](https://docs.p0.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.p0.dev/integrations/resource-integrations/1password.md).

# 1Password

Install P0 for your 1Password account so people can request a read-only, time-limited share link to one item.

This page documents how to install P0 for your 1Password account so people can request just-in-time access to one item. When a request is approved, P0 makes a read-only share link to the item that opens only for the requestor's email, and 1Password stops opening it when the approved time is up.

{% hint style="info" %}
The 1Password integration is in beta. Functionality and configuration may change.
{% endhint %}

## How it works

* **You create one service account for each 1Password account.** It has the **Read Items** and **Share Items** permissions on exactly the vaults people may request items from, and nothing else. P0 lists the vaults the service account can see, so its vault access in 1Password decides what people can request. 1Password fixes a service account's vaults when you create it, so changing them means creating a new service account.
* **The token stays in your cloud.** You store the service account token in AWS Secrets Manager or Google Secret Manager, under a name you choose. P0 never reads the token. The connector does.
* **The connector runs in your cloud.** You deploy P0's connector on AWS Lambda or Google Cloud Run, from Terraform that the installer generates. P0 invokes the connector to list vaults and items and to make share links, and the connector calls 1Password with the account's token. One connector can serve many 1Password accounts.
* **You choose the email domains the connector shares with.** The connector's deployment carries an allowed domains pattern that only you can change. The connector makes no link for anyone whose email domain is outside it.
* **The link opens for one person.** P0 shares the item with the email the requestor signs in to P0 with. 1Password asks whoever opens the link to verify that email with a code, and the link shows a read-only copy of the item.

For how a person requests an item and receives the link, see [Requesting 1Password access](https://docs.p0.dev/integrations/resource-integrations/1password/requesting-access.md).

## Before you begin

You need:

* **A 1Password Business or Enterprise account.** Service accounts, and sharing an item with a specific person by email, need one.
* **A 1Password owner or administrator**, to create the service account and to check the account's sharing policy.
* **An item sharing policy that allows sharing with specific people by email.** P0 makes every link for one email address. If the policy limits how long a link can last, P0 can't make a link that lasts longer.
* **At least one item in a vault the service account can see, before you validate.** 1Password reads the sharing policy through an item. If none of those vaults has an item, P0 skips the sharing policy check.
* **Firewall rules that let the connector in.** If your 1Password account has firewall rules, they must allow connections from the connector's cloud and region. Otherwise 1Password refuses the connector's sign-in.
* [**Terraform**](https://developer.hashicorp.com/terraform/install), to deploy the connector and to let it read the token.

You deploy the connector on AWS Lambda or on Google Cloud Run, and store the token in the same cloud's secret manager. The secret can be in another account or project than the connector's.

For a connector on AWS Lambda, you also need:

* [AWS](https://docs.p0.dev/integrations/resource-integrations/aws.md#setting-up-aws-iam-management) **for the account the connector runs in.** P0 invokes the connector through it.
* [AWS Secrets Manager](https://docs.p0.dev/integrations/resource-integrations/aws-secrets-manager.md) **integration for the account that holds the token.** The installer lists only the accounts where it's installed. That account needs AWS IAM management installed first, as in [AWS](https://docs.p0.dev/integrations/resource-integrations/aws.md#setting-up-aws-iam-management).
* **Terraform 1.4 or later, run where Docker and the AWS CLI are installed**, with the AWS CLI signed in to the connector's account. Applying the connector's Terraform copies P0's connector image from Docker Hub into Amazon ECR.
* **Commercial AWS regions** for the connector and the token's secret. The 1Password integration doesn't support AWS GovCloud, China, ISO or European Sovereign Cloud regions.

For a connector on Google Cloud Run, you also need:

* [Google Cloud](https://docs.p0.dev/integrations/resource-integrations/google-cloud.md#install-iam-management-on-each-project) **for the project the connector runs in.** P0 invokes the connector through it.
* [Google Secret Manager](https://docs.p0.dev/integrations/resource-integrations/google-secret-manager.md) **integration for the project that holds the token.** The installer lists only the projects where it's installed.
* **The IAM, Cloud Run and Secret Manager APIs** enabled in the connector's project: `iam.googleapis.com`, `run.googleapis.com` and `secretmanager.googleapis.com`.
* **The `gcloud` CLI**, to store the token.

## Install 1Password

You install a connector first, then each 1Password account it serves. You choose a connector for each account: one connector can serve all your accounts, or each account can have its own, for example to give each account its own allowed domains.

1. Open the P0 dashboard at [p0.app](https://p0.app) and log in to your organization.
2. In the sidebar, click **Integrations**. Under **Resources**, click **1Password**.

1Password has two components. You install the **Connector** component in steps 1 to 3. You install the **Account** component in steps 4 to 8, which you repeat for each 1Password account whose items people should be able to request. Most organizations have one.

### Step 1: Add a connector

You can't change where a connector runs once you add it, so decide its cloud, its account or project, its region and its name now.

1. Select the **Connector** component, and click **Add connector**.
2. In **Connector ID**, enter a name for this connector in P0, such as `prod`. Each 1Password account you add picks its connector by this ID.
3. In **Connector hosting**, choose **AWS Lambda** or **Google Cloud Run**, and fill in its fields. If the list of accounts or projects is empty, install the integration it names first. See [#before-you-begin](#before-you-begin "mention").

For **AWS Lambda**:

| Field                | What to enter                                                                                                                                                                 |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **AWS account ID**   | The account the connector runs in. The list shows the accounts where P0's AWS IAM management is installed.                                                                    |
| **Connector name**   | The name of the connector's Lambda function, 2 to 64 characters. The connector's Terraform creates the function, and an IAM role of the same name that the connector runs as. |
| **Connector region** | An AWS region, such as `us-west-2`                                                                                                                                            |

For **Google Cloud Run**:

| Field                | What to enter                                                                                                                                                                        |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **GCP project ID**   | The project the connector runs in. The list shows the projects where P0's Google Cloud IAM management is installed.                                                                  |
| **Connector name**   | The name of the connector's Cloud Run service, 6 to 30 characters. The connector's Terraform creates the service, and a service account of the same name that the connector runs as. |
| **Connector region** | A Google Cloud region, such as `us-west1`                                                                                                                                            |

4. Click **Next**. P0 saves the connector and opens its setup page.

A connector ID uses lowercase letters, digits and hyphens, starts and ends with a letter or digit, and has up to 63 characters. A connector name uses lowercase letters, digits and hyphens, starts with a letter, and ends with a letter or digit. On AWS Lambda, it can't have two hyphens in a row.

If P0 can't save the connector, it shows why at the top of the form. See [#when-you-add-a-connector-or-an-account](#when-you-add-a-connector-or-an-account "mention") for each message.

### Step 2: Set the allowed domains

The setup page has the connector's Terraform, filled in with the values from step 1. Before you apply it, set the allowed domains.

The connector shares items only with people whose email domain matches its allowed domains pattern. The pattern is the `domain_allow_pattern` setting in the connector's Terraform, which passes it to the connector as `DOMAIN_ALLOW_PATTERN`. The setting is required. The connector won't start without a pattern, with a blank one, or with one that isn't a valid regular expression.

The pattern is a regular expression that the connector tests against the part of an email after the `@`. For `acme.com`, the Terraform reads:

```terraform
domain_allow_pattern = "^acme\\.com$"
```

That's the regular expression `^acme\.com$`, with each backslash doubled as a Terraform string needs. For two domains, use `^(acme\.com|acme\.io)$`.

{% hint style="warning" %}
**Anchor the pattern with `^` and `$`.** The connector doesn't anchor it for you. An unanchored `acme\.com` also matches `notacme.com` and `acme.com.evil.io`, and the connector would share items with addresses at those domains too. Escape each dot as well, because a bare `.` matches any character.
{% endhint %}

* One pattern covers every 1Password account the connector serves. To allow different domains for different accounts, add a connector for each.
* You set the pattern on your own deployment, and P0 can't change it. Each account's page in P0 shows it as **Allowed domains**, as the connector reported it the last time P0 validated the account.
* The pattern ignores case, as domain names do: `^acme\.com$` also allows `Alice@Acme.com`.
* The pattern is what keeps links inside your company. Depending on its sharing settings, 1Password can accept any email address as a link's recipient.
* The connector checks the pattern each time it makes a link. A narrower pattern doesn't take back links it has already made.

### Step 3: Deploy the connector

The Terraform that P0 shows deploys P0's connector image where step 1 says, and lets P0 invoke it. The connector reaches 1Password over the internet, so it needs no VPC. See [#what-the-deployment-creates](#what-the-deployment-creates "mention").

1. Copy the Terraform from the setup page, and add it to your configuration with the pattern from step 2. Leave the account or project, the region and the connector name as they are. P0 invokes the connector exactly there.
2. For a connector on AWS Lambda, add the credential settings your other AWS providers use, such as `profile` or `assume_role`, to the `aws` provider that the Terraform declares.
3. Apply it.
4. Click **Next**. P0 checks that it can invoke the connector. For a connector on Cloud Run, P0 also finds the service's URL.
5. Click **Finish**.

If the check fails right after you apply the Terraform, wait a minute and click **Next** again. See [#when-p0-validates-the-install](#when-p0-validates-the-install "mention") for each message.

Until you click **Finish**, the connector doesn't appear in an account's **Connector** list.

### Step 4: Add an account

Once you add an account, you can't change its sign-in address, its connector, the secret manager and the account or project that hold its token, or the secret's name. Decide them now.

1. On the 1Password integration's page, select the **Account** component, and click **Add account**.
2. In **Account sign-in address**, enter the address you sign in to 1Password at, in lowercase and without `https://`, such as `acme.1password.com`. It ends in `.1password.com`, `.1password.ca` or `.1password.eu`.
3. In **Connector**, pick the connector that shares this account's items. The list shows the connectors you've finished installing.
4. In **Secret manager provider**, choose the secret manager in the connector's cloud, and fill in its fields. The field starts as **AWS Secrets Manager**, so change it for a connector on Cloud Run.

| Secret manager provider                                 | Field              | What to enter                                                                                                                     |
| ------------------------------------------------------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------- |
| **AWS Secrets Manager**, for a connector on AWS Lambda  | **Installation**   | The AWS account the secret is in. The list shows the accounts where P0's AWS Secrets Manager integration is installed.            |
|                                                         | **Secrets region** | The secret's AWS region, such as `us-west-2`                                                                                      |
| **Google Secret Manager**, for a connector on Cloud Run | **Installation**   | The Google Cloud project the secret is in. The list shows the projects where P0's Google Secret Manager integration is installed. |

5. In **Service account token secret**, enter the name of the secret that holds, or will hold, the account's service account token. Enter the name, not the ARN or the full resource name, and never the token itself. P0 refuses any name that starts with `ops_`, as every 1Password service account token does.
6. Click **Next**. P0 saves the account and opens its setup page.

You don't add vaults to P0. The service account you create in step 5 decides which vaults people can request items from.

You can create the secret before or after you add the account. You store the token in it in step 6. In AWS Secrets Manager, the secret's name can't end in a hyphen and six letters or digits, such as `-AbCdEf`, because Secrets Manager reads that as the suffix of a full ARN.

If the secret is in another AWS account than the connector's, encrypt it with a customer-managed KMS key. Another account can't use the default `aws/secretsmanager` key.

### Step 5: Create the service account

A 1Password owner or administrator creates one service account for this 1Password account:

1. Sign in to your 1Password account. Go to **Developer**, then **Directory**, and create a service account under **Service Accounts**.
2. Give it a name that says what it's for, such as `P0 connector`.
3. Give it access to exactly the vaults people may request items from, with the **Read Items** and **Share Items** permissions on each. Give it no other vault and no other permission. Choose carefully: after you create a service account, 1Password doesn't let you add vaults to it or change its permissions.
4. Finish creating it, and copy the token. 1Password shows the token once. It starts with `ops_`.

P0 lists the vaults the service account can see, so people can request items only from those. Service accounts can't access Personal, Private or Employee vaults, so P0 can't share items from those.

The service account needs each permission for these jobs:

| Permission  | What P0 uses it for                                                             |
| ----------- | ------------------------------------------------------------------------------- |
| Read Items  | List the vaults and their items for a request, and read the item that P0 shares |
| Share Items | Make the share link for an approved request                                     |

For more on service accounts, see 1Password's [service accounts guide](https://developer.1password.com/docs/service-accounts/get-started/).

### Step 6: Store the token

Store the token under the secret's name and in the place from step 4.

1. Run this first, paste the token and press Enter. It reads the token without showing it:

```bash
read -rs ONEPASSWORD_TOKEN
```

2. Create the secret. In AWS Secrets Manager:

```bash
printf %s "$ONEPASSWORD_TOKEN" | aws secretsmanager create-secret \
  --name <secret-name> \
  --secret-string file:///dev/stdin \
  --region <region>
```

In Google Secret Manager:

```bash
printf %s "$ONEPASSWORD_TOKEN" | gcloud secrets create <secret-name> \
  --project <project-id> \
  --data-file=-
```

For a secret in another AWS account than the connector's, also pass `--kms-key-id <kms-key-arn>`, with the ARN of the secret's customer-managed KMS key.

If the secret already exists, store the token as a new version instead, as in [#change-the-install-later](#change-the-install-later "mention").

3. Clear the token from your shell:

```bash
unset ONEPASSWORD_TOKEN
```

### Step 7: Let the connector read the token

The account's setup page has the Terraform for this step, which lets the connector read this one secret and no other.

1. Copy the Terraform from the setup page, and add it to your configuration.
2. On AWS, add the credential settings your other AWS providers use to the `aws` provider that the Terraform declares. If a customer-managed KMS key encrypts the secret, set `kms_key_arn` to that key's ARN.
3. Apply it.

The Terraform grants the connector this, and nothing else:

| Secret manager        | What the Terraform grants                                                                                                                                                                                |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| AWS Secrets Manager   | A policy on the connector's role with `secretsmanager:GetSecretValue` on the token's secret. If you set `kms_key_arn`, the policy also has `kms:Decrypt` on that key.                                    |
| Google Secret Manager | `secretmanager.versions.access` and `secretmanager.versions.get` for the connector's service account, on the secret itself and not on its project. The secret must exist before you apply the Terraform. |

If the secret is in another AWS account than the connector's, the secret's account also needs a resource policy that lets the connector's role read the secret, and the key's policy needs a statement that lets the role decrypt with the key. The setup page has the Terraform for that account too. Apply it after the connector's own Terraform, because it names the connector's role.

{% hint style="warning" %}
**Limit the connector's read access to the token secrets of the accounts it serves.** P0 names the secret in each call to the connector, so any other secret the connector can read, whether through a wildcard or through a grant on the whole account or project, is one a call could point it at.
{% endhint %}

### Step 8: Validate and configure

1. Click **Next**. P0 asks the connector to read the token, sign in to 1Password, list the vaults the service account can see, read the account's sharing policy through an item in one of those vaults, and read its allowed domains. The service account must see at least one vault. Each check runs in that order, and the first one that fails stops the rest. If none of the vaults has an item, P0 skips the sharing policy check. P0 makes no share link while it validates.
2. P0 opens the account's configure page. It shows the fields from step 4, which you can't change, and **Allowed domains**, the pattern the connector reported. Check that it's the pattern you set in step 2.
3. Choose whether to turn on **One-time links**. It's off by default. When it's on, each share link for this account opens only once, so the person should copy what they need when they open it.
4. Choose a **Request limit**: how many open requests a person may have in this account at a time. To request again, they revoke their open request first.

| Request limit                 | A person may have                                   |
| ----------------------------- | --------------------------------------------------- |
| **One per item**, the default | One open request for each item                      |
| **One per vault**             | One open request in each vault                      |
| **One in this account**       | One open request across all of the account's vaults |

5. Click **Finish**. People can't request the account's items until you do.

You can change **One-time links** and **Request limit** later. See [#change-the-install-later](#change-the-install-later "mention").

If a check fails, P0 shows what to fix at the top of the page. See [#when-p0-validates-the-install](#when-p0-validates-the-install "mention") for each message. Fix it, then click **Next** again. If P0 says the connector isn't allowed to read the secret right after you apply the Terraform, wait a few seconds and click **Next** again.

{% hint style="success" %}
People can now request items from the vaults the service account can see. See [Requesting 1Password access](https://docs.p0.dev/integrations/resource-integrations/1password/requesting-access.md).
{% endhint %}

## Install with Terraform

{% hint style="info" %}
The `p0_1password_*` resources require P0 Terraform provider [v0.71.0](https://github.com/p0-security/terraform-provider-p0/releases/tag/v0.71.0) or later.
{% endhint %}

Instead of the installer, you can install 1Password with the P0 Terraform provider. See [Manage integrations as code with the P0 Terraform provider](https://docs.p0.dev/getting-started/get-started-with-the-p0-terraform-provider.md). You still create the service account and store its token, as in [#step-5-create-the-service-account](#step-5-create-the-service-account "mention") and [#step-6-store-the-token](#step-6-store-the-token "mention"). Each resource's page in the Terraform registry has a complete example for each cloud, including the cloud resources. Create the resources in this order:

1. **Stage the connector** with [`p0_1password_connector_staged`](https://registry.terraform.io/providers/p0-security/p0/latest/docs/resources/1password_connector_staged). Set `id` and `hosting`. P0 answers with `connector_identity`, the IAM role or service account the connector must run as.
2. **Deploy the connector** where `hosting` says, and set its `DOMAIN_ALLOW_PATTERN` environment variable to the pattern from [#step-2-set-the-allowed-domains](#step-2-set-the-allowed-domains "mention"). The pattern isn't an attribute of any P0 resource. Pin the connector's image to a published tag and that tag's digest, as the examples do. P0 publishes the tags on Docker Hub.
   * **AWS Lambda:** use the image `p0security/p0-connector-1password`, copied into Amazon ECR. Run the function as `connector_identity.role_name`, and give P0's AWS IAM management role `lambda:InvokeFunction` on the function.
   * **Google Cloud Run:** use the image `p0security/p0-connector-1password-gcloud`, running as `connector_identity.service_account_email`. Give P0's Google Cloud service account `roles/run.invoker` and `roles/run.viewer` on the service, and set the connector's `INVOKER_SA_EMAIL` environment variable to that same service account's email.
3. **Install the connector** with [`p0_1password_connector`](https://registry.terraform.io/providers/p0-security/p0/latest/docs/resources/1password_connector), with the same `id` and `hosting` as the staged resource. P0 checks that it can invoke the connector.
4. **Let the connector read the token's secret**, with the permissions in [#step-7-let-the-connector-read-the-token](#step-7-let-the-connector-read-the-token "mention").
5. **Add each account** with [`p0_1password_account`](https://registry.terraform.io/providers/p0-security/p0/latest/docs/resources/1password_account). Set `id` to the sign-in address, `connector`, `secret_manager` and `token_secret_name`, and make it depend on the secret's read access. `one_time_links` and `request_limit` are optional.

For example, an account on a connector that runs on AWS Lambda:

```terraform
resource "p0_1password_account" "acme" {
  id        = "acme.1password.com"
  connector = p0_1password_connector.prod.id

  secret_manager = {
    type           = "aws-sm"
    account_id     = "123456789012"
    secrets_region = "us-west-2"
  }
  token_secret_name = "1password/acme/token"

  one_time_links = true
  request_limit  = "vault"

  depends_on = [aws_iam_role_policy.p0_1password_acme_token]
}
```

Creating the account has P0 check it through the connector, as in [#step-8-validate-and-configure](#step-8-validate-and-configure "mention"). If a check fails, the apply fails with P0's message, and Terraform marks the resource as tainted. Fix what the message names and apply again: Terraform deletes the account and creates it again.

Changing an account's `one_time_links` or `request_limit` updates it in place. Changing its `id`, `connector`, `secret_manager` or `token_secret_name` replaces it, and changing a connector's `id` or `hosting` replaces the connector. To rotate the token, store the new one as a new version of the same secret, which needs no change in Terraform.

### Import what you added in the P0 app

If you already added a connector or an account in the P0 app, the apply fails and says to import it. Import a connector into both of its resources, and an account into its one:

```bash
terraform import p0_1password_connector_staged.prod prod
terraform import p0_1password_connector.prod prod
terraform import p0_1password_account.acme acme.1password.com
```

## What the deployment creates

The connector's Terraform gives the connector no secret. Each account's Terraform adds read access to that account's token secret, as in [#step-7-let-the-connector-read-the-token](#step-7-let-the-connector-read-the-token "mention"). P0 gets only what it needs to invoke the connector.

On AWS Lambda:

| Resource                                               | What it's for                                                                 |
| ------------------------------------------------------ | ----------------------------------------------------------------------------- |
| An ECR repository                                      | Holds the copy of P0's connector image that Lambda runs.                      |
| A CloudWatch log group, `/aws/lambda/<connector-name>` | The connector's logs.                                                         |
| An IAM role, named after the connector                 | The role the connector runs as, with write access to its own log group.       |
| The Lambda function                                    | Runs the connector. It calls 1Password over the internet, so it needs no VPC. |
| A policy on P0's role in the account                   | `lambda:InvokeFunction` on the connector's function, and nothing else.        |

On Google Cloud Run:

| Resource                                                  | What it's for                                                                                                      |
| --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| A service account, named after the connector              | The identity the connector runs as.                                                                                |
| The Cloud Run service                                     | Runs the connector, from P0's connector image on Docker Hub. It has no VPC, and calls 1Password over the internet. |
| Two IAM bindings on the service, for P0's service account | `roles/run.invoker`, to invoke the connector, and `roles/run.viewer`, to read the service's URL when you install.  |

The connector never logs a share link, an item's field values or the token.

## Access policies

In an access policy's resource, as in [Configuring access policies](https://docs.p0.dev/policy-studio/policy-studio/configure-your-first-access-policy.md#resource), 1Password is the service `1password`, and its access type is `item`.

### Available filters

A rule can filter on these properties of a request:

| Filter     | Keys          | What it matches                                                                                | Example              |
| ---------- | ------------- | ---------------------------------------------------------------------------------------------- | -------------------- |
| `account`  | `name`        | The 1Password account's sign-in address                                                        | `acme.1password.com` |
| `vault`    | `name`, `id`  | The vault's name, or its 26-character ID                                                       | `Engineering`        |
| `item`     | `title`, `id` | The item's title in 1Password when it was requested, or its ID                                 | `Prod database`      |
| `itemType` | `name`        | The item's category in 1Password, such as `Login`, `Password`, `ApiCredential` or `SecureNote` | `Login`              |

P0 records the vault's name and the item's ID, title and category when the request is made, so a rule can match them before approval. Patterns are unanchored, case-sensitive regular expressions. Use `^` and `$` to match a whole value.

### Example access policy

These policies send requests for Login items in the `Engineering` vault to P0 approval, and deny every request for an item whose title starts with `root`:

```yaml
- requestor:
    type: any
  resource:
    type: integration
    service: 1password
    accessType: item
    filters:
      vault:
        effect: keep
        key: name
        pattern: ^Engineering$
      itemType:
        effect: keep
        key: name
        pattern: ^Login$
  approval:
    - type: p0
- requestor:
    type: any
  resource:
    type: integration
    service: 1password
    accessType: item
    filters:
      item:
        effect: keep
        key: title
        pattern: ^root
  approval:
    - type: deny
```

## Error messages

P0 shows these messages when you add a connector or an account, when it validates the install, and on requests. Once you've fixed the cause, retry what failed. Where a message names an account, it names the account by its sign-in address.

### When you add a connector or an account

P0 checks the form when you click **Next** in [#step-1-add-a-connector](#step-1-add-a-connector "mention") or [#step-4-add-an-account](#step-4-add-an-account "mention"), and saves nothing if a check fails. Fix the field the message names, then click **Next** again.

| Message                                                                                                                                                                                                                       | What to do                                                                                                                                                                                                                                     |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `The connector <id> is already added. To change it, remove <id> and add it again.`                                                                                                                                            | Open the connector from the list instead, or choose another ID.                                                                                                                                                                                |
| `Use lowercase letters, digits and hyphens only, starting and ending with a letter or digit, up to 63 characters.`                                                                                                            | Choose a connector ID that follows the rule.                                                                                                                                                                                                   |
| `Use 2 to 64 characters for the connector name: lowercase letters, digits and single hyphens, starting with a letter and ending with a letter or digit.`                                                                      | For AWS Lambda, choose a **Connector name** that follows the rule.                                                                                                                                                                             |
| `Use 6 to 30 characters for the connector name: lowercase letters, digits and hyphens, starting with a letter and ending with a letter or digit. The connector's service account takes the same name.`                        | For Cloud Run, choose a **Connector name** that follows the rule.                                                                                                                                                                              |
| `Enter the AWS region the connector runs in, such as us-west-2.`, or a message like it for another account, project or region field                                                                                           | Enter that field as the message says.                                                                                                                                                                                                          |
| `P0's 1Password integration supports only AWS's commercial regions for now.`                                                                                                                                                  | Use a commercial AWS region for the connector and the secret.                                                                                                                                                                                  |
| `The 1Password account <account> is already added. To change it, remove <account> and add it again.`                                                                                                                          | Open the account from the list instead.                                                                                                                                                                                                        |
| `Enter the 1Password account's sign-in address, such as acme.1password.com: the address you sign in at, without https://.`                                                                                                    | Enter the sign-in address in lowercase. It ends in `.1password.com`, `.1password.ca` or `.1password.eu`.                                                                                                                                       |
| `Pick the connector that shares this account's items. Install a 1Password connector first if there's none.`                                                                                                                   | Pick a connector. If the list is empty, finish steps 1 to 3 for a connector first, up to **Finish**.                                                                                                                                           |
| `The token's secret must be in the connector's cloud: AWS Secrets Manager for a connector on AWS Lambda, or Google Secret Manager for one on Cloud Run.`                                                                      | Change **Secret manager provider** to the one in the connector's cloud.                                                                                                                                                                        |
| `Enter the name of the secret that holds, or will hold, the account's service account token.`                                                                                                                                 | Fill in **Service account token secret**.                                                                                                                                                                                                      |
| `That's a 1Password service account token, not the name of its secret. Enter the name of the secret that holds the token. P0 never needs the token itself, so revoke it and create a new one if it was shared anywhere else.` | Enter the secret's name in **Service account token secret**. P0 shows this message for any name that starts with `ops_`, so use a secret whose name starts another way. If you pasted the token anywhere else, revoke it and create a new one. |
| `That doesn't look like a secret name. Enter the name of the secret that holds the service account token, not its ARN, its full resource name or the token itself.`                                                           | Enter the secret's name. Never paste the token itself into the form.                                                                                                                                                                           |
| `Secrets Manager can't find a secret by its name when the name ends in a hyphen and six characters, like -AbCdEf. Use a secret whose name doesn't end that way.`                                                              | Choose a secret name that doesn't end in a hyphen and six letters or digits.                                                                                                                                                                   |
| `'<field>' can only be altered on initial installation. Create a new installation to change this field.`                                                                                                                      | You can't change where a connector runs, or an account's connector or secret. Remove it and add it again, as in [#change-the-install-later](#change-the-install-later "mention").                                                              |

### When P0 validates the install

P0 validates a connector when you click **Next** in [#step-3-deploy-the-connector](#step-3-deploy-the-connector "mention"), and an account when you click **Next** in [#step-8-validate-and-configure](#step-8-validate-and-configure "mention"). Fix the cause, then click **Next** again.

Where a message says `<where it runs>`, it names the connector's function or service, such as `the Lambda function p0-1password in AWS account 123456789012, region us-west-2`.

For a connector:

| Message                                                                                                                                                                       | What to do                                                                                                                                |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `P0 couldn't find <where it runs>. It may still be deploying. Check that the connector's Terraform applied, then retry.`                                                      | Check that the Terraform applied, and that it deploys the connector with the account or project, region and name from step 1. Then retry. |
| `P0 isn't allowed to invoke <where it runs>. The connector's Terraform lets P0's role call lambda:InvokeFunction on the function: check that it applied, then retry.`         | For AWS Lambda, apply the connector's Terraform. Right after you apply it, wait a few seconds and retry.                                  |
| `P0 isn't allowed to invoke <where it runs>. The connector's Terraform grants P0 roles/run.invoker on the service: check that it applied, then retry.`                        | For Cloud Run, apply the connector's Terraform. Right after you apply it, wait a few seconds and retry.                                   |
| `P0 isn't allowed to read <where it runs>, so it can't find its URL. The connector's Terraform grants P0 roles/run.viewer on the service: check that it applied, then retry.` | For Cloud Run, apply the connector's Terraform, then retry.                                                                               |
| `<where it runs> has no URL yet. It may still be deploying. Check that the connector's Terraform applied, then retry.`                                                        | For Cloud Run, wait for the service to finish deploying, then retry.                                                                      |
| `P0 found <where it runs>, but it isn't ready yet. It may still be starting. Retry in a minute, and check its logs if it isn't ready by then.`                                | For Cloud Run, wait a minute and retry. If the service still isn't ready, check its logs.                                                 |
| Any other message                                                                                                                                                             | Check the connector's logs for why the call failed, then retry.                                                                           |

A connector whose allowed domains pattern is blank, or isn't a valid regular expression, doesn't start. Its logs then have a line that starts `DOMAIN_ALLOW_PATTERN isn't`. Fix the pattern as in [#step-2-set-the-allowed-domains](#step-2-set-the-allowed-domains "mention"), and apply the Terraform again.

For an account, a failed check reads `The 1Password account <account> failed its install check while <check>: <what to fix>`. The checks run in this order:

| While                                            | What to fix                                                                                                                                                                                                                                                                                                                            | What to do                                                                                                                                                                                                                                               |
| ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `reading the service account token's secret`     | `The connector couldn't find the 1Password service account token secret <secret>. Check the token secret in the P0 install, and that the secret still exists.`                                                                                                                                                                         | Store the token under the name and in the place from step 4, as in [#step-6-store-the-token](#step-6-store-the-token "mention"). If you named the wrong secret, remove the account and add it again.                                                     |
|                                                  | `The connector isn't allowed to read the 1Password service account token secret <secret>. Grant the connector's identity secretsmanager:GetSecretValue on that secret, and kms:Decrypt on its KMS key if it uses a customer-managed key.`, or the same message naming `secretmanager.versions.access` and `secretmanager.versions.get` | Apply the account's Terraform, as in [#step-7-let-the-connector-read-the-token](#step-7-let-the-connector-read-the-token "mention"). For a secret in another AWS account, apply that account's Terraform too, and add the statement to the key's policy. |
|                                                  | `The 1Password service account token secret <secret> is empty. Store the account's service account token in it.`                                                                                                                                                                                                                       | Store the account's token as a new version of the secret, as in [#change-the-install-later](#change-the-install-later "mention").                                                                                                                        |
| `signing in to 1Password`                        | `1Password didn't accept the service account token. Check that the secret holds the account's current service account token, which starts with ops_, and that the service account is active.`                                                                                                                                          | Check that the secret holds the token, and that no one revoked the service account or its token. If your account has firewall rules, check that they allow the connector's cloud and region.                                                             |
| `listing the vaults the service account can see` | `P0 couldn't list the vaults the service account can see. Check that the service account is active.`                                                                                                                                                                                                                                   | Check that no one revoked the service account in 1Password.                                                                                                                                                                                              |
|                                                  | `The service account can't see any vault. In 1Password, give it Read Items and Share Items on each vault people may request items from.`                                                                                                                                                                                               | Give the service account access to the vaults people may request items from, as in [#step-5-create-the-service-account](#step-5-create-the-service-account "mention").                                                                                   |
| `reading 1Password's item sharing policy`        | `P0 couldn't read 1Password's item sharing policy. Check that the service account has Read Items and Share Items on its vaults.`                                                                                                                                                                                                       | Give the service account both permissions on each of its vaults.                                                                                                                                                                                         |
|                                                  | `1Password's item sharing policy doesn't allow sharing an item with a specific person by email. Ask a 1Password owner or administrator to allow it.`                                                                                                                                                                                   | A 1Password owner or administrator allows sharing with specific people by email, in 1Password's item sharing settings.                                                                                                                                   |
| `reading its allowed email domains`              | `The connector's DOMAIN_ALLOW_PATTERN is missing or can't be used. Set it in the connector's Terraform to an anchored regular expression for the email domains P0 may share items with, such as ^acme\.com$, apply it, then retry.`                                                                                                    | Set `domain_allow_pattern` as in [#step-2-set-the-allowed-domains](#step-2-set-the-allowed-domains "mention"), and apply the connector's Terraform again.                                                                                                |

At any of these checks, the part after the colon can also be one of these:

| What to fix                                                                                                                                                                           | What to do                                                                                                                                                              |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `1Password no longer accepts the account's service account token. Store a current service account token in the token secret.`                                                         | The token expired, or someone revoked it. Store a current token as a new version of the secret, as in [#change-the-install-later](#change-the-install-later "mention"). |
| `1Password is limiting the connector's calls, or is unavailable. Retry in a few minutes.`, or `1Password is rate limiting the account's service account. Try again in a few minutes.` | Wait a few minutes, then click **Next** again.                                                                                                                          |
| A message that starts `1Password failed the connector's call`                                                                                                                         | Check the connector's logs, then retry.                                                                                                                                 |

Other messages for an account:

| Message                                                                                                                                                                                       | What to do                                                                                                                                              |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `The connector <id> isn't installed. Install it again with the same ID and hosting, or remove the account <account> and add it again with another connector.`                                 | Add the connector again, as in steps 1 to 3, with the same ID and hosting.                                                                              |
| `P0 invoked <where it runs>, but it didn't answer as the 1Password connector. Check that it runs the connector's image, and check its logs, then retry.`                                      | Check that the function or service is the one the connector's Terraform deployed, and apply that Terraform again. If it is, check the connector's logs. |
| `P0 couldn't reach the connector, <where it runs>. It may have been removed, or P0 may no longer be allowed to invoke it. Check that the connector's Terraform is still applied, then retry.` | Check that the connector still runs where its page in P0 says, and apply its Terraform again.                                                           |
| `The connector for the 1Password account <account> answered its install check with something P0 can't read. Check that it runs a current image of P0's 1Password connector, then retry.`      | Apply the connector's Terraform with the image it names, then retry.                                                                                    |

### On requests

Requestors and approvers see these messages on a request. For the messages a requestor sees as they request, see [Requesting 1Password access](https://docs.p0.dev/integrations/resource-integrations/1password/requesting-access.md#troubleshooting).

| Message                                                                                                                                                                                                        | What to do                                                                                                                                                                                                                                                                                                                                               |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Your email domain isn't allowed for the 1Password vault <vault>. Ask your P0 admin to check the connector's allowed domains.`                                                                                 | The requestor's email domain doesn't match the connector's pattern. If they should be able to request items, change the pattern as in [#step-2-set-the-allowed-domains](#step-2-set-the-allowed-domains "mention"). The message names the vault by its ID.                                                                                               |
| `1Password's item sharing policy doesn't allow sharing an item with a specific person by email. Ask a 1Password owner or administrator to allow it.`                                                           | A 1Password owner or administrator allows sharing with specific people by email.                                                                                                                                                                                                                                                                         |
| `1Password's item sharing policy allows links that last up to <longest>, shorter than the <requested> requested. Request a shorter duration, or ask a 1Password owner or administrator to allow longer links.` | The requestor asks for a shorter duration, or a 1Password owner or administrator allows longer links.                                                                                                                                                                                                                                                    |
| `P0 couldn't reach the 1Password connector. Ask your P0 admin to check its deployment.`                                                                                                                        | Check that the connector still runs where its page in P0 says, and apply its Terraform again. Check too that P0's AWS IAM management or Google Cloud IAM management is still installed for its account or project.                                                                                                                                       |
| `P0's 1Password connector couldn't read the account's service account token. Ask your P0 admin to check the 1Password install.`                                                                                | Check that the secret exists under the name on the account's page in P0, that it holds the token, and that you've applied the account's Terraform, as in [#step-7-let-the-connector-read-the-token](#step-7-let-the-connector-read-the-token "mention").                                                                                                 |
| `The 1Password connector for <account> isn't installed, so P0 can't share its items. Ask your P0 admin to install it.`                                                                                         | Add the connector again, as in steps 1 to 3, with the same ID and hosting.                                                                                                                                                                                                                                                                               |
| `The 1Password connector for <account> didn't make the link the account's one-time links setting asks for. Ask your P0 admin to update the connector to its current image.`                                    | The connector runs an older image. Apply the connector's Terraform with the image it names, then the requestor requests again.                                                                                                                                                                                                                           |
| `You already have an open request for <what> (<request ID>). Revoke it, then request again.`                                                                                                                   | The requestor has another request that the account's **Request limit** counts, waiting for approval or approved with its link. They revoke that request, then request again. See [Requesting 1Password access](https://docs.p0.dev/integrations/resource-integrations/1password/requesting-access.md#requesting-from-the-p0-cli) for what `<what>` says. |

## Change the install later

* **Change which vaults people can request from.** 1Password doesn't let you change a service account's vaults after you create it. Create a new service account with the vaults you want, as in [#step-5-create-the-service-account](#step-5-create-the-service-account "mention"), and store its token as a new version of the same secret, as below. The connector signs in with the new token on its next call, and the vaults P0 lists change with it. Then delete the old service account in 1Password.
* **Replace the token.** Create a new token for the account's service account, or a new service account as in [#step-5-create-the-service-account](#step-5-create-the-service-account "mention"), and store the token as a new version of the same secret. Read the token as in [#step-6-store-the-token](#step-6-store-the-token "mention"), then run the command for your secret manager.

  In AWS Secrets Manager:

  ```bash
  printf %s "$ONEPASSWORD_TOKEN" | aws secretsmanager put-secret-value \
    --secret-id <secret-name> \
    --secret-string file:///dev/stdin \
    --region <region>
  ```

  In Google Secret Manager:

  ```bash
  printf %s "$ONEPASSWORD_TOKEN" | gcloud secrets versions add <secret-name> \
    --project <project-id> \
    --data-file=-
  ```

  Then clear the token from your shell with `unset ONEPASSWORD_TOKEN`. The connector reads the secret itself, so nothing changes in P0 or in your Terraform.
* **Change which vaults people can request items from.** The service account's vault access decides them. Create a service account with **Read Items** and **Share Items** on the vaults you want, as in [#step-5-create-the-service-account](#step-5-create-the-service-account "mention"), and store its token as in **Replace the token**. P0 lists the vaults from the new service account, so nothing changes in P0.
* **Turn one-time links on or off, or change the request limit.** Open the account in P0, change **One-time links** or **Request limit** on its configure page, and click **Finish**. The change applies to links and requests made after it. Links P0 already made keep working as they did.
* **Change the allowed domains.** Change `domain_allow_pattern` in the connector's Terraform, and apply it again. See [#step-2-set-the-allowed-domains](#step-2-set-the-allowed-domains "mention") for what the pattern matches.
* **Move a connector, or change an account's connector or secret.** You can't change these once you add a connector or an account. Remove it, then add it again with the new values. Links P0 has already made keep working until they expire.
* **Remove a connector.** Remove one only when no account uses it. Until you add it again with the same ID and hosting, P0 can't make links for the accounts that use it.

## Limitations

* **People get a read-only copy.** The link shows the item as it was when P0 made the link. It doesn't give access to the vault, and changes to the item afterward don't reach the link.
* **P0 can't revoke a link early.** Ending access in P0, or a narrower allowed domains pattern, doesn't stop a link that P0 already made. To stop one before it expires, a 1Password owner or administrator deletes it from the item's sharing history.
* **Links last one of 1Password's set durations.** P0 rounds the approved duration down to 1 hour, 1 day, 7 days, 14 days or 30 days. A 3-day request gets a link that lasts 1 day, and a request for less than an hour gets a link that lasts 1 hour.
* **Business and Enterprise accounts only.** 1Password Teams and Families accounts aren't supported.
* **No Personal, Private or Employee vaults.** Service accounts can't access them, so P0 can't share their items.
* **One service account per 1Password account.** Each account you add has its own service account and its own token secret, which covers every vault people may request items from in that account.
* **Your firewall rules apply to the connector.** If your 1Password account has firewall rules, they must allow connections from the connector's cloud and region, or every check and request fails at sign-in.
