Beta
You can now set up your 1Password SDK integrations to authenticate using secure, local authorization prompts from the 1Password desktop app. During the public beta, you can:
- Build integrations that require minimal setup from end users. Your users can authorize your integration the same way they unlock their 1Password app, like with biometric unlock, their 1Password account password, or other supported methods.
- Enable human-in-the-loop approval for sensitive workflows. Prompts from 1Password clearly detail which account the integration will access and the scope and duration of that access.
- Allow users to securely grant your integration temporary access to their entire 1Password account while the 1Password desktop app is unlocked. Access expires after 10 minutes of inactivity or when the user locks their account in the app.
Requirements
Beta limitationsDesktop app authentication is currently only supported on Mac and Linux devices. Windows support will be available with the General Availability (GA) release.
Step 1: Turn on the integration in the 1Password app
To get the latest beta release of the 1Password desktop app, select your account or collection at the top of the sidebar, then select Settings > Advanced and set “Release channel” to Beta. Then navigate to Settings > About > Check for updates and restart the app when prompted.If you don’t see the option to update to the latest beta in the app, you can download it directly for Mac or Linux.
- Open and unlock the 1Password app.
- Select your account or collection at the top of the sidebar.
- Navigate to Settings > Developer.
- Under Integrate with the 1Password SDKs, select Integrate with other apps.
- If you want to authenticate with Touch ID, navigate to Settings > Security, then turn on Touch ID.
- Open and unlock the 1Password app.
- Select your account or collection at the top of the sidebar.
- Navigate to Settings > Developer.
- Under Integrate with the 1Password SDKs, select Integrate with other apps.
- If you want to authenticate the same way you sign in to your Linux account, navigate to Settings > Security, then turn on Unlock using system authentication.
Step 2: Install the beta SDK
The beta is available on the sdk-for-desktop-integrations branch in each 1Password SDK repository (Go, Python, JS). You’ll need to install the SDK from that branch.
go get github.com/1password/onepassword-sdk-go@v0.4.0-beta.1
npm install @1password/sdk@0.4.0-beta.1
pip install onepassword-sdk==0.4.0b1
Then import the SDK into your project. If you have an existing project, you don’t need to change your import statements.
import "github.com/1password/onepassword-sdk-go"
CommonJS
const sdk = require("@1password/sdk");
ES Modules
import sdk from "@1password/sdk";
from onepassword import *
Step 3: Connect your project to the 1Password app
To get started with the beta SDK, you’ll create a client instance that authenticates using the 1Password desktop app.
Replace YourAccountNameAsShownInTheDesktopApp in the code below with the name of your account as it appears at the top of the left sidebar in the 1Password desktop app. You can also use your account UUID.
You can additionally configure your client to authenticate with service accounts if you want to use both authentication methods.
// Connects to the 1Password desktop app.
client, err := onepassword.NewClient(context.Background(),
onepassword.WithDesktopAppIntegration("YourAccountNameAsShownInTheDesktopApp"), // TODO: Set to your 1Password account name.
// TODO: Set the following to your own integration name and version.
onepassword.WithIntegrationInfo("My 1Password Integration", "v1.0.0"),
)
if err != nil {
panic(err)
}
// Connects to the 1Password desktop app.
const client = await sdk.createClient({
auth: new sdk.DesktopAuth("YourAccountNameAsShownInTheDesktopApp"), // TO DO: Set to your 1Password account name.
// Set the following to your own integration name and version.
integrationName: "My 1Password Integration",
integrationVersion: "v1.0.0",
});
# Connects to the 1Password desktop app.
client = await Client.authenticate(
auth=DesktopAuth(
account_name="YourAccountNameAsShownInTheDesktopApp" # TO DO: Set to your 1Password account name.
),
# Set the following to your own integration name and version.
integration_name="My 1Password Integration",
integration_version="v1.0.0",
)
Step 4: Test authentication with the 1Password app
To test the new authentication method, build a simple project that requires access to 1Password, or configure an existing project to authenticate with the 1Password desktop app.
When you run your integration, 1Password will prompt you to authenticate. You’ll need to reauthorize after ten minutes and authorize each process separately. If your account locks, you’ll need to unlock your 1Password desktop app and run the integration again.
The following example lists all the vaults in your account. Make sure to replace YourAccountNameAsShownInTheDesktopApp with the account name you see at the top left of the sidebar in the 1Password app.
package main
import (
"context"
"encoding/json"
"fmt"
"github.com/1password/onepassword-sdk-go"
)
func main() {
// Connects to the 1Password desktop app.
client, err := onepassword.NewClient(context.Background(),
onepassword.WithDesktopAppIntegration("YourAccountNameAsShownInTheDesktopApp"),
// TODO: Set the following to your own integration name and version.
onepassword.WithIntegrationInfo("My 1Password Integration", "v1.0.0"),
)
if err != nil {
panic(err)
}
// Lists all vaults in the account.
vaults, err := client.Vaults().List(context.Background())
if err != nil {
panic(err)
}
for _, vault := range vaults {
b, _ := json.MarshalIndent(vault, "", " ")
fmt.Println(string(b))
}
}
import sdk from "@1password/sdk";
async function main() {
// Connects to the 1Password desktop app.
const client = await sdk.createClient({
auth: new sdk.DesktopAuth("YourAccountNameAsShownInTheDesktopApp"),
// Set the following to your own integration name and version.
integrationName: "My 1Password Integration",
integrationVersion: "v1.0.0",
});
const vaults = await client.vaults.list();
for (const vault of vaults) {
console.log(vault);
}
}
main();
from onepassword import *
import asyncio
async def main():
# Connects to the 1Password desktop app.
client = await Client.authenticate(
auth=DesktopAuth(
account_name="YourAccountNameAsShownInTheDesktopApp" # Set to your 1Password account name.
),
# Set the following to your own integration name and version.
integration_name="My 1Password Integration",
integration_version="v1.0.0",
)
vaults = await client.vaults.list()
for vault in vaults:
print(vault)
if __name__ == "__main__":
asyncio.run(main())
You can find more examples on GitHub:
Get help or share feedback
To share feedback or suggest improvements, create a New Issue in the relevant SDK GitHub repository using the provided template.
If you have additional questions or feedback, please reach out in the 1Password Developer Slack.