1Password / op-js

A JS library powered by the 1Password CLI
https://developer.1password.com/docs/cli
MIT License
91 stars 8 forks source link

Add support for service accounts #164

Closed jodyheavener closed 3 months ago

jodyheavener commented 10 months ago

Summary

With 1Password Service Accounts launched we should add support for configuring a service account with op-js.

Use cases

Proposed solution

Much like Connect env vars, allow the user to set a service account token via env var: OP_SERVICE_ACCOUNT_TOKEN.

Note: 1Password CLI only supports a subset of commands with service accounts. It may be worth trying to figure out a solution that wraps each command in a check, if a service account is being used, if the command supports it.

Is there a workaround to accomplish this today?

Don't think so.

dreusel commented 6 months ago

Setting process.env['OP_SERVICE_ACCOUNT_TOKEN'] actually works for me.

Raj123456788 commented 3 months ago

Hey @dreusel I tried to connect using the service account with process.env but it did not work. Can you please share your example in detail? Thanks

jodyheavener commented 3 months ago

Addressed in https://github.com/1Password/op-js/commit/bf5f9971535de0bf9ab80e4cbe60e17cbe85fdc0