Fill 1Password logins in a Steel session
1Password is a password manager. With a Secret Connection, a Steel session fills a login from 1Password into a sign-in form. The login stays in 1Password: Steel reads it when the session needs it and does not store a copy. Your code and your agent never get the password.
Steel signs in to 1Password with a service account token. A session can use only the 1Password vaults or items that you bind to it.
Before you begin
- A 1Password account that can create service accounts.
- A Steel API key in the
STEEL_API_KEYenvironment variable, for the API, SDK and CLI steps. See API keys. Secret Connections says what the SDK and CLI examples need. - A login item in 1Password with a website address. Steel fills the item only on a page whose origin equals one of the item's websites.
Set up the integration
Create a service account
In 1Password, create a service account and give it read access to the vaults that your sessions need. Get started with 1Password Service Accounts shows the steps. Copy the token and put it in the OP_SERVICE_ACCOUNT_TOKEN environment variable.
Give the service account only the vaults that Steel needs. You cannot change a service account's vaults later in 1Password, so a new vault needs a new service account.
Connect 1Password
In the dashboard:
- Open Credentials in the sidebar, then the Connections tab.
- Click Connect provider.
- Type a Name, and choose 1Password as the Provider.
- Paste the Service account token.
- Click Test, then Connect provider.
With the API, an SDK or the CLI:
curl -X POST https://api.steel.dev/v1/secret-connections \
-H "steel-api-key: $STEEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "team-1password",
"provider": "1password",
"auth": { "serviceAccountToken": "'"$OP_SERVICE_ACCOUNT_TOKEN"'" }
}'const connection = await client.secretConnections.create({
name: "team-1password",
provider: "1password",
auth: { serviceAccountToken: process.env.OP_SERVICE_ACCOUNT_TOKEN! },
});
console.log(connection.id);connection = client.secret_connections.create(
name="team-1password",
provider="1password",
auth={"service_account_token": os.environ["OP_SERVICE_ACCOUNT_TOKEN"]},
)
print(connection.id)printf '{ "name": "team-1password", "provider": "1password", "auth": { "serviceAccountToken": "%s" } }' \
"$OP_SERVICE_ACCOUNT_TOKEN" | steel secret-connections createThe response has the connection's id, name, provider and enabled. It never has the token.
Bind a vault or an item to a session
A binding names what the session can use. You write it as a reference:
| Reference | The session can use |
|---|---|
steel:// | Every item in the 1Password vault, and each one that you add later |
steel:// | One item |
<connection> is the connection's name or ID. <vault> and <item> are a 1Password name or ID. Percent-encode a character that is not a letter, a digit, -, ., _ or ~. For example, write a space as %20.
Steel stores a binding by ID. If you later delete an item and make a new one with the same name, a binding to the old item does not follow.
In the dashboard:
- Open Sessions, and click Start session.
- Under Credential access, choose Choose what this session can use.
- Under Binding type, choose External provider item, then choose the connection.
- Type the Provider Vault name or ID.
- Under Provider access, choose Whole provider Vault, or choose Individual item and type the Item name or ID.
- Click Start session.
With the API or an SDK, pass the references in credentials.bindings when you create the session:
curl -X POST https://api.steel.dev/v1/sessions \
-H "steel-api-key: $STEEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"credentials": {
"bindings": ["steel://connections/team-1password/vaults/Automation/Acme%20billing"]
}
}'const session = await client.sessions.create({
credentials: {
bindings: ["steel://connections/team-1password/vaults/Automation/Acme%20billing"],
},
});session = client.sessions.create(
credentials={
"bindings": ["steel://connections/team-1password/vaults/Automation/Acme%20billing"],
},
)Change what a running session can use shows how to add or remove a binding later.
Open the sign-in page
Open the site's sign-in page in the session. Steel finds the bound items whose website matches the page, and fills the username, the password and, if the item has one, the one-time password. Steel makes the one-time password code itself. The item's one-time password secret never reaches the browser.
Steel matches an item to a page by these rules:
- The page's origin must equal the origin of one of the item's websites: the same scheme, host and port. A subdomain is another origin.
- A website with no scheme, such as
app.example.com, counts ashttps://app.example.com. - Steel skips a website whose autofill behavior in 1Password is Never fill on this website.
When two bound items match one page, Steel does not choose between them and fills nothing. Bind one item, or choose one with Steel.credentials.fill.
Check that it worked
List what the session can use:
curl https://api.steel.dev/v1/sessions/$SESSION_ID/credentials \
-H "steel-api-key: $STEEL_API_KEY"const access = await client.sessions.credentials.list(session.id);
console.log(access.lookup, access.bindings);access = client.sessions.credentials.list(session.id)
print(access.lookup, access.bindings)steel sessions credentials list $SESSION_IDThe response has "lookup": "explicit" and your reference in bindings, with IDs in place of names. Then open the sign-in page in the session's live view. Steel fills the form shortly after the page loads.
Troubleshooting
The sign-in form stays empty
Cause: No bound item matches the page. The item has no website, its website has another origin than the page, or the item is new. Steel keeps the list of a vault's items for up to 30 seconds.
Fix: In 1Password, set the item's website to the sign-in page's address. Wait 30 seconds, then load the page again.
Verify: Steel fills the form.
reference_not_found
Cause: The service account cannot see the vault or the item that the reference names, or the name is wrong. The request fails with 400.
Fix: Check the names, and percent-encode them. Give the service account read access to the vault.
Verify: The session starts, and GET /v1/sessions/$SESSION_ID/credentials lists the binding.
credential_rate_limited
Cause: The connection used up its request budget. The default budget fits a 1Password Business account. Other plans have lower limits.
Fix: Set a lower budget for the connection, as Limit requests to the provider shows. 1Password's rate limits lists the limit of each plan.
Verify: Sessions fill the form again after the budget refills.