This guide walks you through using the 1Password SDK with Stagehand and Playwright to securely authenticate on websites without hardcoding credentials.Documentation Index
Fetch the complete documentation index at: https://docs.browserbase.com/llms.txt
Use this file to discover all available pages before exploring further.
This guide assumes you have a 1Password account and a Browserbase account. If you don’t, create a 1Password account and Browserbase account.
1. Create your 1Password vault
Create a specific vault structure for this integration.Create the vault
- 1Password App
- 1Password.com
- Open the 1Password app and sign in to your account
- Click the plus + button in the sidebar
- Name your vault:
Browserbase Agent - Optionally add a description like “Credentials for Browserbase automation”
- Click Create
Add your Browserbase credentials
- In your new
Browserbase Agentvault, click New Item - Select Login as the item type
- Fill in the details:
- Title:
Browserbase - Username: Your Browserbase email address
- Password: Your Browserbase password
- Title:
- Click Save
Your vault structure should now be:
op://Browserbase Agent/Browserbase/username and op://Browserbase Agent/Browserbase/password2. Create a service account
Create a Service Account to allow programmatic access to your vault.You need admin access to your 1Password account to create a Service Account.
- Navigate to 1Password.com and sign in
- Go to the Developer tab in the sidebar
- Under Service Accounts, click New Service Account
- Name your Service Account:
Browserbase Agent Account - Select the vault you created in Step 1:
Browserbase Agent - Click Create Account
- IMPORTANT: Copy the Service Account token that appears
This Service Account token is sensitive and will only be shown once. Store it securely - you’ll need it for the
OP_SERVICE_ACCOUNT_TOKEN environment variable.3. Install dependencies
- npm
- pnpm
- yarn
4. Configure environment
Create a.env file in your project root:
.env
5. Implement authentication
Create anindex.ts file with the following code:
index.ts
6. Run your script
Execute your script to see the 1Password integration in action:- npm
- pnpm
- yarn
Next steps
Contexts
Learn more about using contexts to automate workflows across login-gated sites
Session recordings
Learn more about using session recordings to debug and optimize your workflows